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

Conditional Format % using FORMAT() function

Hi All,

 

I have a dax measure using a SWITCH() statement. Sometimes the result will be a whole number and sometimes a percent. I am using the FORMAT() function when obtaining a %.

 

The only issue is when applying conditional formatting to the measure, it is not applied to any result diplaying x%. I am guessing becasue the format function is displaying text not a number?

 

Does anyone know a solution or work around for this?

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous 

You can refer to the following example

Sample data 

vxinruzhumsft_0-1682563036140.png

 

Measure 1

Measure 3 = IF(SELECTEDVALUE('Table'[Column2])>=0.5&&SELECTEDVALUE('Table'[Column2])<=2,SELECTEDVALUE('Table'[Column2])*100&"%",SUM('Table'[Column2]))

Then create a formatter measure

Measure 4 = var a=IF(CONTAINSSTRING([Measure 3],"%"),CONVERT(LEFT([Measure 3],SEARCH("%",[Measure 3],1,BLANK())-1),DOUBLE)/100,[Measure 3])
return IF(a>=10,"red",IF(a>0.5&&a<2,"blue","green"))

Then put the measure to the conditional formatting

vxinruzhumsft_1-1682563139807.png

 

vxinruzhumsft_2-1682563145985.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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 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.

Top Solution Authors