Forum Discussion
If statement with measure condition not showing correct values in Power BI Desktop
Hi,
I have 3 columns customer name, Rev last year and Rev Current Year in table visualization
Customer name is from Dimension table and Rev is from Fact table.
I have created a flag custom column with below formula.
bhaskarpbi999 - Calculated Columns are not computed dynamically in visualisations so you should transform this to a measure with:
IF(SUM(FACT_TABLE[Rev CY])>SUM(FACT_TABLE[Rev LY]),1,0)If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
Hi bhaskarpbi999 , Hope you are doing good,
Try replacing your calculated column with a DAX measure:
Flag Measure =
IF(
[Rev CY] > [Rev LY],
1,
0
)Measures are evaluated at the level of the visualization, ensuring proper comparisons.
If this post helps to answer your question, please consider accepting it as a solution so others can find it more quickly when they face a similar challenge.
Proud to be a Microsoft Fabric community super user
Let's Connect on LinkedIn
Subscribe to my YouTube channel for Microsoft Fabric and Power BI updates.
5 Replies
- mark_endicott
Super User
bhaskarpbi999 - Calculated Columns are not computed dynamically in visualisations so you should transform this to a measure with:
IF(SUM(FACT_TABLE[Rev CY])>SUM(FACT_TABLE[Rev LY]),1,0)If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
- bhaskarpbi999
Helper V
Hi Mark,
Thanks for your extreme support
Regards,
Bhaskar
- mark_endicott
Super User
bhaskarpbi999 - Why did you not accept mine as the solution? it was submitted before the other and is exactly the same.
I just used the full syntax.
- anmolmalviya05
Super User
Hi bhaskarpbi999 , Hope you are doing good,
Try replacing your calculated column with a DAX measure:
Flag Measure =
IF(
[Rev CY] > [Rev LY],
1,
0
)Measures are evaluated at the level of the visualization, ensuring proper comparisons.
If this post helps to answer your question, please consider accepting it as a solution so others can find it more quickly when they face a similar challenge.
Proud to be a Microsoft Fabric community super user
Let's Connect on LinkedIn
Subscribe to my YouTube channel for Microsoft Fabric and Power BI updates.- bhaskarpbi999
Helper V
Hi Anmol,
Thanks and Kudos to your support.
Aceepting it as a solution.
Regards,
Bhaskar