Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
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.
@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()
)
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.
@Anonymous Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
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?
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
117 | |
84 | |
49 | |
38 | |
28 |
User | Count |
---|---|
188 | |
76 | |
73 | |
54 | |
42 |