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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
raymondpocher
Advocate III
Advocate III

Conditional Formatting with Switch and Selected Measure or Value

Hello,

 

I have a ton of measures in cards and want to color code them. The color coding rule is always the same. Problem is, how can I apply it to all of my different measures.

 

Since it would be ridiculous to manually define each color condition I am looking for way to do that all at once. 

 

I was super excited to use the selected measure function of dax...but it wasn't working. Can anyone help?

 

 

Sample Color Coding Background = 
SWITCH(
    TRUE(),
        SELECTEDMEASURE() < 0.8, "#E34858",
        SELECTEDMEASURE() < 0.95, "#EB6F24",
        SELECTEDMEASURE() > 0.95, "#2EA675"
)

 

 

And I cant use Tabular Editor since it is blocked from our IT.

8 REPLIES 8
Smis
Regular Visitor

*bump* Did anyone find a solution to this?
If I replace SELECTEDMEASURE() with the one of the actual measures it works; but Microsoft shows this as an example on how to use the SELECTEDMEASURE() function, so I guess this should work??
https://learn.microsoft.com/en-us/dax/selectedmeasure-function-dax

I have the measure below on conditional formatting; but it is returning both positive as negative values in green.

MeasureColor =
    SWITCH(
        TRUE(),
         SELECTEDMEASURE() < 0, "Red",
         SELECTEDMEASURE() >= 0, "Green"
    )

Hi , unfortunately this doesn't work for the case above . I haven't found a solution yet.

GG23
New Member

Have you found a solution for this? I'm needing the same. Thanks

tavolo89
Frequent Visitor

Did you ever find an answer to this? I'm trying to do the same via Tabular Editor using SELECTEDMEASURE() but it does nothing for the font colour.

Anonymous
Not applicable

I'm struggling with the same problem.
Did u find a workaround?
Calculation item measure cant be applied btw.

bpn1973_0-1644183948162.png

but the measure is greyed out when trying to use it as condition

bpn1973_1-1644184020941.png

 

 

raymondpocher
Advocate III
Advocate III

@amitchandak : do you know if there is a free version? Or do you have any experience on that regarding licensing. Would only the person that creates the report need a tabular license or anyone who views a report?

amitchandak
Super User
Super User

@raymondpocher , as far as I know, you have to create it from tabular editor only.

Appreciate your logic. Good Idea to reduce measures.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks but seriously? 😄 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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