Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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.
User | Count |
---|---|
14 | |
11 | |
6 | |
6 | |
5 |
User | Count |
---|---|
29 | |
17 | |
11 | |
7 | |
5 |