Forum Discussion
IF statement calculating both values
- 1 year ago
Hi Adams_Apple
Th's good to hear the measure is working for you! In order to works sum of total correct, you may use SUMX function to iterate over the table and calculate total sum correctly. Give a try with the below measure.
Projected_BinsPacked = SUMX( VALUES('Date'[Date].[Month]), CALCULATE( COALESCE(SUM('Bins'[Bins Packed]), MAX(Projections[Bins Packed]))) )Let me know if it works.
Thank you!
Hi Adams_Apple
It seems like your current approach likely uses an IF statement that checks for the existence of actual data. If actual data exists, the measure should use it. Otherwise, it should use projected data. you can try with COLEASE dax function in place of IF. Let's give a try with below measure
Projected_BinsPacked =
CALCULATE(
SUMX(
VALUES('Date'[Date].[Month]),
COALESCE(SUM('Bins'[Bins Packed]), MAX(Projections[Bins Packed])))
)
Let me know if it works.
Thanks
- Adams_Apple1 year agoFrequent Visitor
that works great, thank you. however, the sum total isn't correct. how can i modify that measure so it has the correct sum total?
- suparnababu81 year agoSuper User
Hi Adams_Apple
Th's good to hear the measure is working for you! In order to works sum of total correct, you may use SUMX function to iterate over the table and calculate total sum correctly. Give a try with the below measure.
Projected_BinsPacked = SUMX( VALUES('Date'[Date].[Month]), CALCULATE( COALESCE(SUM('Bins'[Bins Packed]), MAX(Projections[Bins Packed]))) )Let me know if it works.
Thank you!
- Adams_Apple1 year agoFrequent Visitor
Thank you so much, works perfectly!