Forum Discussion
Stuck with the sum and if
Hi All,
I am trying to replicate the SQL case when statement in the Power BI as a calculated measure.
The SQL statement is
(CASE WHEN 'Target Flag' = 'Actual' AND 'Date.FYear' = '2023'
THEN 'X.var'
ELSE 0
END)
The calculated measure has to SUM the X.var if the above
conditions are true
Hi, vidheesha ;
Try it.
measure = IF ( MAX ( [Target Flag] ) = "Actual" && MAX ( [Date.FYear] ) = 2023, SUM ( [X.var] ), 0 )
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- VijayP
Community Champion
Switch(sum(valuecolumn), 'Target Flag' = 'Actual' && 'Date.FYear' = '2023', "Required value",0)
More powerbi tips on www.youtube.com/perepavijay
- v-yalanwu-msft
Community Support
Hi, vidheesha ;
Try it.
measure = IF ( MAX ( [Target Flag] ) = "Actual" && MAX ( [Date.FYear] ) = 2023, SUM ( [X.var] ), 0 )
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.