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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ejoneslor
Helper II
Helper II

Conditional format a cqard based on a measure

Hi,

I have created a simple visual using cards and measures to give the screenshot below. The section above the line uses measures that are affected by slicers, the section below the line is the same measures but unaffected by slicers.

I want to apply conditional formatting based on the top section being higher or lower in value to the bottom.

As an example, on the right hand side, 611.49 is a higher number than 391.92 so I want the text to turn green, equally I would want it red if it was less.

The numbers in the bottom section are not constants and will change as data is updated.

Is this formatting possible when I'm effectively comparing two outputs from the same measure?

thanks,

Ed

 

Power BI Snip.JPG

 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @ejoneslor ,

 

I think you will need to create two separate measures. One of the measure is affected by the slicer, the other is not.

Then create the third measure to compare these two slicers and use the third slicer as the rule of conditional formatting.

Please see the example below.

Measure1 = CALCULATE(AVERAGE('Table'[value]),ALL('Table'))

Measure2 = CALCULATE(AVERAGE('Table'[value]),FILTER(ALL('Table'),'Table'[month]=SELECTEDVALUE('Table'[month])))

Measure3 = IF([Measure1]>[Measure2],1,0)

1.PNG

2.PNG

3.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @ejoneslor ,

 

I think you will need to create two separate measures. One of the measure is affected by the slicer, the other is not.

Then create the third measure to compare these two slicers and use the third slicer as the rule of conditional formatting.

Please see the example below.

Measure1 = CALCULATE(AVERAGE('Table'[value]),ALL('Table'))

Measure2 = CALCULATE(AVERAGE('Table'[value]),FILTER(ALL('Table'),'Table'[month]=SELECTEDVALUE('Table'[month])))

Measure3 = IF([Measure1]>[Measure2],1,0)

1.PNG

2.PNG

3.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

Thanks Jay, this should work perfectly.

MFelix
Super User
Super User

Hi @ejoneslor ,

 

You need to create a second measure that compares the values with and without filters.

 

Assuming that you have a simple measure of a sum what you can do is to create the following measure:

 

 

Measure = SUM(Table[Column])


Comparision Measure = [Measure] - CALCULATE([Measure], ALL(Table))

 

 

Now you can use the second measure to make the condittional formatting. Be aware that I don't have any information about your model so this measure is not optimized the use of the Table in the ALL syntax is not advised.

 

But overall setting should be similar to the one above.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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