Forum Discussion

FAA9's avatar
FAA9
Frequent Visitor
3 years ago
Solved

Summing conditional measure

Hello,
I have a measure which is conditioned on the value of two other measures (whose values are shown as columns in the table below). I am getting correct numbers on rows, but subtotals are not correct. 

 

In the table below, the last column (corrected supplies) is conditioned on supply vs demand. If supply is >150% of demand, then it takes demand*1.5, otherwise it takes the value in supply column (1st one which is a calculated measure itself).

The correct total is 22,029. However with my measure I get the same total as the 1st column (as I am unable to add row context to the IF condition).
Please help on how to resolve this

 

 

2 Replies

    • FAA9's avatar
      FAA9
      Frequent Visitor

      Hi, I tried using that bit didnt work for me 😞

       

      It looks sowmthing like this but I tried using different versions. Nothing seems to be working:

       

       

      SUMX(SUMMARIZE(Main_tbl, Main_tbl[_date],Main_tbl[_type], Main_tbl[Key]), CALCULATE( [Corrected Supplies]))

      Corrected Supplies = If (Y > 1.5, 1.5*Demand(X), W)

      (in the table all are measures btw everything is calculated based on some date restrictions)