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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
PBI_Rookie
Helper I
Helper I

Matrix Conditional Formatting

Hello,

 

I have a matrix with the following. I'm trying to highlight values in the Measured column if it is > or < the limits(LSL, USL).The matrix varies by filters so a static value or percentage won't work.  I'm missing something on setting up the dax and keep hitting errors. 

PBI_Rookie_0-1604357321455.png

Any help is appreciated. 

 

Thanks

1 ACCEPTED SOLUTION

Ah, yes, sorry I thought your LSL and USL were measures. Since they are columns average aggregation should work, you just need to add brackets;

 

VAR LowerLimitCheck = Average(vw_Specifications[LSL])-Average(vw_QAresults[VALUE]) 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

5 REPLIES 5
PBI_Rookie
Helper I
Helper I

Allison, 

 

That solved it!

A little more work to figure out what to do with a (blank - a value)  using this format but this is workable!

 

Thank you

amitchandak
Super User
Super User

@PBI_Rookie , You can create a color meausre like the given example

color =
switch ( true(),
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity1" && sum('Table'[Value]) >500,"lightgreen",
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity2" && sum('Table'[Value]) >1000,"lightgreen",
// Add more conditions
"red"
)

 

color = Switch( True(), [Meausre]<[LSL] , "Red",

[Meausre]>=[LSl] && [Meausre]<[USL],"Orange",

"green"

)

And then use it in conditional formatting with "field value: option 

 

refer: https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AllisonKennedy
Super User
Super User

You should be able to create another Measure that calculates:
Format =
VAR LowerLimitCheck = [LSL]-[Measured]
VAR UpperLimitCheck =[Measured]-[USL]
RETURN IF(LowerLimitCheck >0, "Below LSL", IF(UpperLimitCheck >0, "Above USL", "Within limits"))
You can change the "Above USL" and "Below LSL" and "Within Limits" to other text or colours or numbers and then apply conditional formatting based on that measure.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

I tried what you suggested Allison.

 

I replaced your varibles with the names of my tables and columns.

 

Format =
VAR LowerLimitCheck =(vw_Specifications[LSL]-vw_QAresults[VALUE]
VAR UpperLimitCheck =(vw_QAresults[VALUE]-vw_Specifications[USL]
RETURN IF(LowerLimitCheck >0, "Below LSL", IF(UpperLimitCheck >0, "Above USL", "Within limits"))

I got the following error

image.png

 

I thought I could solve that by adding Average  as my aggregation ex: VAR LowerLimitCheck = Average(vw_Specifications[LSL]-Average(vw_QAresults[VALUE] and get a Var syntax error. 

 

Ah, yes, sorry I thought your LSL and USL were measures. Since they are columns average aggregation should work, you just need to add brackets;

 

VAR LowerLimitCheck = Average(vw_Specifications[LSL])-Average(vw_QAresults[VALUE]) 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
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 Kudoed Authors