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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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 @Anonymous ,
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-numbers-in-the-column

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!





Anonymous
Not applicable

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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