cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
ShazaibShoukath
Regular 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
Regular 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
Regular 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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors