Skip to Content
author's profile photo Former Member
Former Member

BPC 10 Script Logic: Using MDX Median

Hello!

First, sorry if I posted in the wrong place, because it is my first post. This is a question about the BPC Script Logic 10.

I'm having trouble making a "script logic" in BPC 10 which calculates the median (not average) read where all values ​​in that dimension "TYPE" is equal to 1 and record this result in the "TYPE" = 111.

Below a piece of the script, in which the problem occurs:

* When TYPE

* IS 1

* Rec (Expression = Median ([TYPE]. [1], [Measures]. [SignedData]); TYPE = 111) / / ERROR OCCURS HERE

* ENDWhen

* Commit

That is, if you had the following information lines

Line 1: 5

Line 2: 15

Line 3: 22

I want him to severe 15 (median) for each item, playing in TYPE 111.

I think the problem is because Median is an MDX and do not know to use it in code.

Could anyone help me?

Thank you

David

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Feb 04, 2013 at 11:43 AM

    Hi David,

    try please

    * Rec (Expression = Median ([TYPE]. [1], [Measures]. [SignedData]); TYPE = "111")

    Kind regards

    Roberto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 05, 2013 at 12:43 AM

    I tried the code below. Shows no error, but the calculation is not done correctly.

    I'm trying to use AVG initially to facilitate the calculation is being done correctly.

    *XDIM_MEMBERSET CAT_APURACAO = 1

    *XDIM_MEMBERSET PERIODO_APURACAO = 2

    *XDIM_MEMBERSET TIME = NONE

    *XDIM_MEMBERSET TIPO = 11

    [TIPO].[#11]=AVG({[TIPO].[111],[REVENDA].AllMembers}) //here the code

    *COMMIT

    In case you have 4 members in the dimension [REVENDA]. Each member has the following values ​​in the dimension [TIPO] = 111:

    First: 6515295

    Second: 4633418

    Third: 5666779

    Bedroom: 3103285

    The average was 4,979,694 and 5,150,098 median. That is, the calculation using AVG, he should write to each [REVENDA] the value 4979694. However, it is writing 28861790 in 4 members. Someone could tell what is wrong??

    Note: AVG used to facilitate the conference, what I really need is the median.

    Thank you

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 08, 2013 at 01:13 PM

    Hi,

    I am using the code:

    [TIPO].[#111]=MEDIAN({FILTER([REVENDA].[R].Children, ([REVENDA].CurrentMember.Properties("AS")=%AS% or [REVENDA].CurrentMember.Properties("AS")='N') and ([REVENDA].CurrentMember.Properties("TERCEIRO")=%TERCEIRO% or [REVENDA].CurrentMember.Properties("TERCEIRO")='N'))},[TIPO].[11])

    It was working, but now is giving error in executing the mdx

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.