Forum Discussion

raionpbi's avatar
raionpbi
Frequent Visitor
7 years ago
Solved

Dynamic Calculation Contexts based on respective column

Hi,

I'd like to calculate totals within L1 in the table where only L2 is available (2nd table to present 8 and 15 for a1,a2,a3 and b1,b2,b3 respectively instead of total of 23). Thus the calculation must know the context, that for eg. 'a1' 'a' is the base.

I currently use:

  • Total L1 = CALCULATE(sum(Tab1[value]); all(Tab1[L2]))
  • Total = CALCULATE(sum(Tab1[value]); all(Tab1[L1];Tab1[L2])

Any help appreciated.

Thank you.

  • Hi raionpbi

     

    You may refer to below measure:

    Total L1 =
    CALCULATE ( SUM ( Tab1[value] ), ALL ( Tab1 ), VALUES ( Tab1[L1] ) )

     

    Regards,

    Cherie

1 Reply

  • v-cherch-msft's avatar
    v-cherch-msft
    Microsoft Employee

    Hi raionpbi

     

    You may refer to below measure:

    Total L1 =
    CALCULATE ( SUM ( Tab1[value] ), ALL ( Tab1 ), VALUES ( Tab1[L1] ) )

     

    Regards,

    Cherie