Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Help understanding SUMX / Calculatetable code logic


I joined a new BI team recently and found the following measure:

Order Value =
     CALCULATETABLE ( Orders, Orders[Order Index] = 1 ),
        SUM ( 'Order Items'[USD Value] ),
        ALLEXCEPT ( Orders, Orders[Primary Order] ),
        Orders[Order Index] = 2 ) )

What I don't understand is how this measure returns any value at all.


The inner calculate returns a sum filtered on  'Orders'[Order Index] = 2.

then there's a calculatetable relating to that sum, filtering the result to only 'Orders'[Order Index] = 1.

To my understanding, this should always return blank as you will not have any [Order Index] = 1 in a result alreay filtered to 2.


Is it made possible because of the "allexcept (orders...)"?


Thank you!






Helpful resources

Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors