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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Dr_BB
Regular Visitor

DAX conditional formatting on a switch metric measure

Hello,

 

Thanks in advance for your support!

 

I have written a dax measure (called as Master Measure) which returns formatted values using SWITCH:

Dr_BB_0-1734358347423.png


On this measure I want conditional formatting on few statements in switch, not all.  Formatting - red color for negative, green color for positive. Example DAX as shown below, I want color on SELECTEDVALUE(SALES_KPI_TRACKER[ORDER])=:

Dr_BB_1-1734358635191.png


However, I am not able to achieve the desired formatting. An error in specifying positive / negative value is occurring i.e. in the part : [Master_Measure]>0. I tried removing FORMAT in first main dax, however, still not working.

Request your help on the same. Thanks

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

Change the Format setting of your Master Measure to be dynamic and copy the switch statement into the Format String Expression. Have the switch statement in the measure just return the value without any formatting, and you should then be able to use conditional formatting as normal.

View solution in original post

mark_endicott
Super User
Super User

@Dr_BB - Both FORMAT and FIXED return a string value (text) which will be why you're unable to use an interger or decimal based rule. 

 

You should make use of Dynamic Formatting for your measure, rather than the measure returning a string value. 

 

https://www.sqlbi.com/articles/introducing-dynamic-format-strings-for-dax-measures/

 

If this helps, please consider marking it as the solution, it helps with visibility for others with the same challenge. 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Dr_BB ,

Is my follow-up just to ask if the problem has been solved?

If so, can you accept the correct answer as a solution or share your solution to help other members find it faster?

Thank you very much for your cooperation!

mark_endicott
Super User
Super User

@Dr_BB - Both FORMAT and FIXED return a string value (text) which will be why you're unable to use an interger or decimal based rule. 

 

You should make use of Dynamic Formatting for your measure, rather than the measure returning a string value. 

 

https://www.sqlbi.com/articles/introducing-dynamic-format-strings-for-dax-measures/

 

If this helps, please consider marking it as the solution, it helps with visibility for others with the same challenge. 

johnt75
Super User
Super User

Change the Format setting of your Master Measure to be dynamic and copy the switch statement into the Format String Expression. Have the switch statement in the measure just return the value without any formatting, and you should then be able to use conditional formatting as normal.

lbendlin
Super User
Super User

You cannot measure a measure.  Implement your conditional formatting rules in a separate parallel measure.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.