Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
ShazaibShoukath
Frequent Visitor

DAX query to colour front in red or green

HI guys, I want to change my font colour into green or red depending on dax formula so my ask is, campare asset number from table 1 with table 2, IF the assest number matchs then color the amount field to green else colour the amount as red (If it does'nt match), i want as dax formula for this 

1 ACCEPTED SOLUTION
ShazaibShoukath
Frequent Visitor

got it, Please use this for ref , ##Font Color Measure =
IF(
COUNTROWS(
FILTER(
'table 1',
'table 1'[values] IN VALUES('table 2'[values])
)
) > 0,
"Green",
"Red"
)
##

then after this go to

1.In the "Visualizations" pane, select the table visual and go to the "Conditional formatting" section.

2.Choose the value or column that you want to format based on the measure. For example, if you want to format the "Value" column, select it. then select rules and give string value as green and change the color as green and so on for red too. 

 

please if you find it helpful like it.

View solution in original post

4 REPLIES 4
ShazaibShoukath
Frequent Visitor

got it, Please use this for ref , ##Font Color Measure =
IF(
COUNTROWS(
FILTER(
'table 1',
'table 1'[values] IN VALUES('table 2'[values])
)
) > 0,
"Green",
"Red"
)
##

then after this go to

1.In the "Visualizations" pane, select the table visual and go to the "Conditional formatting" section.

2.Choose the value or column that you want to format based on the measure. For example, if you want to format the "Value" column, select it. then select rules and give string value as green and change the color as green and so on for red too. 

 

please if you find it helpful like it.

pratyashasamal
Super User
Super User

Hi @ShazaibShoukath ,
You can use this type of dax to change the font color dynamically .
For example :-

Measure Value Color = SWITCH(TRUE();
                               [Measure Value] <=1;"#000000";
                               [Measure Value] <99,5;"#e60000";
                               [Measure Value] <100,5;"#000000";
                               [Measure Value] <999999;"#2d862d";
                               "#000000"
                             )   

 You can also refer to these links :-
https://databear.com/changing-colours-using-dax-and-conditional-formatting-in-power-bi/

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...

Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





it working only when you have values inside singel table but i would like to compare the values or columns from 2 diffrent table and see the match, If match is found then give it as green else give as red.

How you are comparing.. which type of visual you are using.. can we have snap of your data model to understand it better

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.