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.
Column1 | Column2 | Column3 | ColorKPI |
A | a2 | 2 | Green |
A | a2 | 4 | Orrange |
A | a2 | 4.5 | Orrange |
A | a3 | 6.7 | Orrange |
A | a3 | 11.6 | Orrange |
A | a3 | 23 | Red |
A | a3 | 2 | Green |
A | a4 | 3 | Orrange |
A | a4 | 4.5 | Orrange |
B | b2 | 11.6 | Orrange |
B | b2 | 23 | Red |
B | b3 | 2 | Green |
B | b3 | 4.5 | Orrange |
B | b4 | 6.7 | Orrange |
C | c2 | 2 | Green |
C | c2 | 4 | Orrange |
C | c3 | 4.5 | Orrange |
C | c4 | 6.7 | Red |
D | d2 | 11.6 | Orrange |
D | d2 | 6.7 | Orrange |
D | d3 | 11.6 | Orrange |
D | d4 | 23 | Red |
D | d4 | 2 | Green |
E | e2 | 3 | Green |
E | e2 | 4.5 | Orrange |
E | e3 | 11.6 | Red |
E | e4 | 4.5 | Orrange |
Solved! Go to Solution.
@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!
@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!