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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
natasha519
Helper II
Helper II

Conditional Format a Measure

I have a measure (Y1SS = if(COUNTROWS(FILTER(od2a_SuccessStory,od2a_SuccessStory[Year]="Year 1")),"Submitted", "Missing")), is there any way I can include in this DAX formula that if it's 'Submitted', I want the text to display as green and if it's 'Missing', then display as red?

 

I tried to color the data label, but since it's a measure I wasn't able to get it to work!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @natasha519 

Add a color measure .

Y1SS Color = if(COUNTROWS(FILTER(od2a_SuccessStory,od2a_SuccessStory[Year]="Year 1")),"#24FF10 ", "#FF470F")

Then choose the measure [Y1SS] you created before , click the drop-down box and select Conditional formatting => Font color , then in Font color pane , select Field value in Format style , Values only in Apply to , the measure which you want to apply color in What field should we base this on .

Ailsamsft_0-1639017052347.png

Ailsamsft_1-1639017052349.png

The final result is as shown :

Ailsamsft_2-1639017052350.png

I have attached my pbix file , you can refer to it .

 

Best Regard

Community Support Team _ Ailsa Tao

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @natasha519 

Add a color measure .

Y1SS Color = if(COUNTROWS(FILTER(od2a_SuccessStory,od2a_SuccessStory[Year]="Year 1")),"#24FF10 ", "#FF470F")

Then choose the measure [Y1SS] you created before , click the drop-down box and select Conditional formatting => Font color , then in Font color pane , select Field value in Format style , Values only in Apply to , the measure which you want to apply color in What field should we base this on .

Ailsamsft_0-1639017052347.png

Ailsamsft_1-1639017052349.png

The final result is as shown :

Ailsamsft_2-1639017052350.png

I have attached my pbix file , you can refer to it .

 

Best Regard

Community Support Team _ Ailsa Tao

natasha519
Helper II
Helper II

Thank you! If I Know the hex code of the green color, how can I incorporate that into the formula? The green is much darker than I thought it would be

Hi @natasha519 

 

Use this link to find the HEX code; https://htmlcolorcodes.com/

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Hi,

You can place the hex code where the "green" or "red" values would be so for example:
Y1SS Color = if(COUNTROWS(FILTER(od2a_SuccessStory,od2a_SuccessStory[Year]="Year 1")),"#24FF10", "#FF470F")





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

Proud to be a Super User!




amitchandak
Super User
Super User

@natasha519 , Create a color measure and use that in conditional formatting using field value option

 

Y1SS Color = if(COUNTROWS(FILTER(od2a_SuccessStory,od2a_SuccessStory[Year]="Year 1")),"green", "red")

 

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.