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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

Hi @Anonymous ,

 

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

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

Anonymous
Not applicable

Thanks Jay, this should work perfectly.

MFelix
Super User
Super User

Hi @Anonymous ,

 

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors