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
RameshPachunuri
Microsoft Employee
Microsoft Employee

I want to apply the color based on min and max values using measure

I want to apply the color based on the column values using measure with min and max with respect to values which are in another column. How can we chiev this?

Suppose we have a table as shown below and I want to create a measure like ColorKPI which calculate colors based on the value from Column3 with respect to value from Column1.


Column1Column2Column3ColorKPI
Aa22Green
Aa24Orrange
Aa24.5Orrange
Aa36.7Orrange
Aa311.6Orrange
Aa323Red
Aa32Green
Aa43Orrange
Aa44.5Orrange
Bb211.6Orrange
Bb223Red
Bb32Green
Bb34.5Orrange
Bb46.7Orrange
Cc22Green
Cc24Orrange
Cc34.5Orrange
Cc46.7Red
Dd211.6Orrange
Dd26.7Orrange
Dd311.6Orrange
Dd423Red
Dd42Green
Ee23Green
Ee24.5Orrange
Ee311.6Red
Ee44.5Orrange
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@RameshPachunuri Please create following measure

and then right click on column on which you want color formatting >> click on conditional formatting >> font color 

In format by drop down select field value 
In based on field select this measure.

Measure = 
VAR _max = CALCULATE(MAX('Table'[Column3]),ALLEXCEPT('Table','Table'[Column1]))
VAR _min = CALCULATE(MIN('Table'[Column3]),ALLEXCEPT('Table','Table'[Column1]))
RETURN SWITCH(TRUE()
                ,MAX('Table'[Column3])=_max,"#cc351b"
                ,MIN('Table'[Column3])=_min,"#42f551"
                ,"#dde01b")



Hit kudos button and mark it as a solution if it helps you!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@RameshPachunuri Please create following measure

and then right click on column on which you want color formatting >> click on conditional formatting >> font color 

In format by drop down select field value 
In based on field select this measure.

Measure = 
VAR _max = CALCULATE(MAX('Table'[Column3]),ALLEXCEPT('Table','Table'[Column1]))
VAR _min = CALCULATE(MIN('Table'[Column3]),ALLEXCEPT('Table','Table'[Column1]))
RETURN SWITCH(TRUE()
                ,MAX('Table'[Column3])=_max,"#cc351b"
                ,MIN('Table'[Column3])=_min,"#42f551"
                ,"#dde01b")



Hit kudos button and mark it as a solution if it helps you!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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