Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I cant find a good solution on this in the forum.
Easy "if" function
IF row A has a value higher than 25000 then RED background
IF row B has a value higher than 40000 then RED background
Else green background
| Year | 2024 | ||
| Month | 1 | 2 | 3 |
| A | 5009 | 26000 | 20604 |
| B | 10438 | 18800 | 40507 |
How do I write this in DAX?
Solved! Go to Solution.
Hi, @Magnusnilsson
You can refer to @johnbasha33 and @Rupak_bi reply, if it does not work, you can try following method.
Measure:
Color =
VAR _value =
SELECTEDVALUE ( 'Table 3'[Value] )
VAR _category =
SELECTEDVALUE ( 'Table 3'[Category] )
VAR _result =
IF (
_value > 25000
&& _category = "A",
"RED",
IF ( _value > 40000 && _category = "B", "RED" )
)
RETURN
_result
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi, @Magnusnilsson
You can refer to @johnbasha33 and @Rupak_bi reply, if it does not work, you can try following method.
Measure:
Color =
VAR _value =
SELECTEDVALUE ( 'Table 3'[Value] )
VAR _category =
SELECTEDVALUE ( 'Table 3'[Category] )
VAR _result =
IF (
_value > 25000
&& _category = "A",
"RED",
IF ( _value > 40000 && _category = "B", "RED" )
)
RETURN
_result
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi,
Create a flag variable using the if condition you mentioned then use that flag to do condiotional formatting in matrix visual.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 5 |
| User | Count |
|---|---|
| 24 | |
| 11 | |
| 9 | |
| 9 | |
| 8 |