cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RameshPachunuri
Microsoft
Microsoft

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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors