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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.