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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Is measure context a thing?

I have lots of cards, each visualising a different measure and I am trying to conditional formatting for the background.

I could create the following measure for each and every card:

IF(CONTAINSSTRING([My Measure1], "test"), "#DS351C", "#00703C")

 

But rather than creating lots of measures, referencing [My Measure1], [My Measure2], [My Measure3].... is there a way to grab the measure context of the visual and have a single conditional formatting measure that checks the result of the measure in the visual and returns the colour as above?

My inital guess was: 

IF(CONTAINSSTRING(SELECTEDMEASURE(), "test"), "#DS351C", "#00703C")

 

But upon further research it doesn't appear SELECTEDMEASURE() is used for this purpose.

Hopefully my request is clear.

Thanks.

6 REPLIES 6
themistoklis
Community Champion
Community Champion

@Anonymous 

Try something like the below formula:

 

Measure Value Color =

SWITCH(TRUE(),
VALUE([Measure Value1]) <=1,"#000000",

VALUE([Measure Value2]) <=15,"#000022",

VALUE([Measure Value2]) <=26,"#000033",

BLANK()

)

 

 

Anonymous
Not applicable

actually thinking about it, this won't work as it it won't cycle through all measures, the moment it hits true it will stop and ignore the following measures thus won't format the remaining backgrounds correctly.

Mahesh0016
Super User
Super User

@Anonymous Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

Hi Mahesh,

 

Unfortunately I can't share a file but to give more context...

Card 1 displays the results of Measure 1, results of Measure 1 = abc

Card 2 displays the results of Measure 2, results of Measure 2 = xyz

Card 3 displays the results of Measure 3, results of Measure 3 = mno

 

i want to conditionally format the background of these cards based on the results of the measures.

 

I could create three measure to do this:

 

Card 1 formatting: IF(CONTAINSSTRING([Measure1], "abc"), "#DS351C", "#00703C")

Card 2 formatting: IF(CONTAINSSTRING([Measure2], "abc"), "#DS351C", "#00703C")

Card 3 formatting: IF(CONTAINSSTRING([Measure3], "abc"), "#DS351C", "#00703C")

 

Is there a function that sees the measure context of the visual that would allow me to have a single measure that i don't have to populate with all measures?

 

 

Anonymous
Not applicable

Hi Mahesh,

 

Unfortunately I can't share a file but to give more context...

Card 1 displays the results of Measure 1, results of Measure 1 = abc

Card 2 displays the results of Measure 2, results of Measure 2 = xyz

Card 3 displays the results of Measure 3, results of Measure 3 = mno

 

i want to conditionally format the background of these cards based on the results of the measures.

 

I could create three measure to do this:

 

Card 1 formatting: IF(CONTAINSSTRING([Measure1], "abc"), "#DS351C", "#00703C")

Card 2 formatting: IF(CONTAINSSTRING([Measure2], "abc"), "#DS351C", "#00703C")

Card 3 formatting: IF(CONTAINSSTRING([Measure3], "abc"), "#DS351C", "#00703C")

 

Or i could do a switch statement as per @themistoklis but is there a function that sees the measure context of the visual that would allow me to have a single measure that i don't have to populate with all measures?

 

 

hello @Anonymous ,
can i know all measure calculated by one column or different column use by every measure and can share your measure writtend.

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.