Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have 3 fields ie., Columns
1)Goal
2)Actual
3)Better value
If the Actual is greater than the Goal and Better Value is High then the condition is True and 4th COlumn Status should be Green if condition fails then Status should be Red.
If the Actual is Less then the Goal and Better values is Low then the condition is True and 4th COlumn Status should be Green if condition fails then Status should be Red.
If the Actual is greater than the Goal and Better Value is Low then the condition is False and 4th COlumn Status should be Red.
If the Actual is Less than the Goal and Better value is high then the condition is False and 4th COlumn Status should be Red.
Goal Actuals Bettervalues Status
12.00 231.00 High G
13.00 321.00 Low R
231.00 123.00 Low G
321.00 421.00 High G
123.00 34.00 High R
321.00 34.00 Low G
34.00 153.86 Low R
34.00 157.80 High G
The code is somthing like this
if((Months_Actuals>Goal)and([Metric - better values]='Low'),red(),
if((Months_Actuals<Goal)and([Metric - better values]='High'),red(),green()))
how to do it in Powerbi DAX
I need to derive a Status Column newly and need to color the cell with Red and Green based on the condition
There is no Colour function in DAX, you have to use conditional formatting for a measure created with below formula
Status Color = IF(AND(SELECTEDVALUE('Test conditional Formating'[Actuals])>SELECTEDVALUE('Test conditional Formating'[Goal]),SELECTEDVALUE('Test conditional Formating'[Bettervalues])="Low"),1,IF(AND(SELECTEDVALUE('Test conditional Formating'[Actuals])<SELECTEDVALUE('Test conditional Formating'[Goal]),SELECTEDVALUE('Test conditional Formating'[Bettervalues])="High"),1,0))
Now you can go to formatting pane and there conditional format for 1 background and font color both as red and same green for 0.
I have uploaded sample file for you reference https://github.com/sourabhkant/PowerBI
HI @SaiKumar123,
Dax not contain any color coding functions, I'd like to suggest you use conditional formatting to instead.
Conditional formatting in tables
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
99 | |
88 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |