power bi deskstop – calculated column result different in daxstudio

Advertisements

Carrying on from my previous question  here  
I still do not understand why pbi desktop table visual not giving the same result as per daxstudio.

Replicated test

--  parent - child rollup test
--  3 rows, 3 values, sumx
EVALUATE
--RollupTest = 
DATATABLE (
    "name", STRING,
    "child value", INTEGER,
    {
        { "test1", 1 },
        { "test2", 3 },
        { "test3", 1 } 
    }
)



EVALUATE
--rollup test =
VAR _rollup =
    SUMX (
        CALCULATETABLE (
            'RollupTest'
        ),
    'RollupTest'[child value]
    )
RETURN
    { _rollup }

Daxstudio

Yep, we get 5  (1+3+1)  correct

PBI Desktop

Nope, the  [rollup test]  column does not return 5 for each of the 3 rows.  Why?

No doubt there is a missunderstanding in my "row context" knowledge.  But to me the [rollup test] calculated column clearly states:

  1. hit the entire ‘rollup test’ table again for each row

  2. sum that temporary table

Which gives result of 5 for each of the 3 row iterations.  Does it not?

This question posted in pbi community link

>Solution :

In a Calculated Column you will have Row Context, so you will only get that one row. To get the whole table then you’ll need to use ALL or other filter function to remove the row context.

Eg:

rollup test =
  SUMX (
    ALL('RollupTest'),
    'RollupTest'[child value]
  )

Leave a ReplyCancel reply