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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ChristineH
Frequent Visitor

Conditional Formatting of the MIN value in rows of a matrix

Hello -

 

I would like to apply conditional formatting by ROW based on a measure. For example, I have a number of bids to compare by site. I would like to change the color of the MIN bid in each row (by site). I've tried a few things I've seen posted but can't quite figure it out. Any suggestions is greatly appreciated.

 

Format Example.jpg

 

 

 

Thanks!

Christine

1 ACCEPTED SOLUTION
ChristineH
Frequent Visitor

I was able to figure this out thanks to so many of you who post tips, tricks, and solutions. This is my first Power BI dashboard and had no idea about DAX functions. After reading many posts, below is how I made it work. 

 

First, I created 2 new Columns and 1 new Measure.

 

 Lowest Rate =

  CALCULATE(

    MIN(

      'All Responses'[2. F1 Rate]),

      FILTER('All Responses','All Responses'[1. Store ID]=EARLIER('All Responses'[1. Store ID])

   )

  )

 

 Winner =

IF('All Responses'[2. F1 Rate]='All Responses'[Lowest Rate],"1","0")

 

Background Color =

VAR HoldColor = SELECTEDVALUE('All Responses'[Winner])

RETURN

IF HoldColor = "1", "#A0D1FF")

 

Then I did Conditional Formatting on the new Measure.

CF.jpg

 

 

 

 

 

 

Results.jpg

View solution in original post

6 REPLIES 6
ChristineH
Frequent Visitor

Just did a quick slicer and it appears to be working correctly. Perhaps its the FILTER / EARLIER functions that is enabling this to work. 

ChristineH
Frequent Visitor

Thank you for the insight. I have not gotten to slicers yet and will be working on the rest of the dashboard tomorrow. I will update with ALLSELECTED and give it a whirl.

daxer-almighty
Solution Sage
Solution Sage

The only problem with your solution is that it'll not work correctly with all slicers and selections. This is because you have not used ALLSELECTED in your code. Your solution is STATIC, meaning that it'll not respond to slicers and filtering correctly. Try it and you'll see...

ChristineH
Frequent Visitor

I was able to figure this out thanks to so many of you who post tips, tricks, and solutions. This is my first Power BI dashboard and had no idea about DAX functions. After reading many posts, below is how I made it work. 

 

First, I created 2 new Columns and 1 new Measure.

 

 Lowest Rate =

  CALCULATE(

    MIN(

      'All Responses'[2. F1 Rate]),

      FILTER('All Responses','All Responses'[1. Store ID]=EARLIER('All Responses'[1. Store ID])

   )

  )

 

 Winner =

IF('All Responses'[2. F1 Rate]='All Responses'[Lowest Rate],"1","0")

 

Background Color =

VAR HoldColor = SELECTEDVALUE('All Responses'[Winner])

RETURN

IF HoldColor = "1", "#A0D1FF")

 

Then I did Conditional Formatting on the new Measure.

CF.jpg

 

 

 

 

 

 

Results.jpg

ChristineH
Frequent Visitor

I can't sem to find the magic combination. I'm new to Power BI and DAX. I have the lowest bid (MIN) per location in a measure that works correctly. I just need to figure out how to turn that measure into a value that can be used  in the Conditional Formatting. 

 

The solution seems to be in getting a RANKX by location then doing a SWITCH to set the color. I'll keep working down that path. 

 

daxer-almighty
Solution Sage
Solution Sage

Write a measure that for each Location will return the rank of the bid. The smallest bid should have rank 1. Use this measure's value in the conditional formatting. The measure will have to use ALLSELECTED somehow. Or, alternatively, you can write a measure that will return the smallest bid for each location. Then you can use this value in the conditional formatting as well. All measures you're gonna write will call for ALLSELECTED.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.