Forum Discussion
lastnn30
4 years agoPost Patron
Interpret a conditional formatting
Hi How you would interpret this conditional formatting rule which highlight the highest number? How you would write one which will highlight the lowest number. Any help would be very much appreciat...
- 4 years ago
Hi, lastnn30
Create a measure to evaluate it:LowestCountHighlight = var ValuesDisplay = CALCULATETABLE( ADDCOLUMNS( SUMMARIZE(SafetyData, SafetyData[Injury Location],SafetyData[Incident Type]), "CountOfIncidentTYpe", CALCULATE(COUNTROWS(SafetyData), ALLEXCEPT(SafetyData, SafetyData[Injury Location]))), ALLSELECTED() ) var MinCOunt = CALCULATE(MINX(ValuesDisplay, [CountOfIncidentTYpe])) var MaxCount = CALCULATE(MAXX(ValuesDisplay, [CountOfIncidentTYpe])) var CurrentValue = COUNTROWS(SafetyData) var Result = SWITCH(TRUE(), CurrentValue = MinCOunt, "#F00", CurrentValue = MaxCount, "#0F0" ) return Result
Then use - Field Value in the Conditional formatting:Or if you wanna have more control, you can return 1 and 2 (1 = min, 2 = max) and then in Conditional formatting -> Rules, you can setup the colors accordingly (if value = 2 then some color etc.)
vojtechsima
4 years agoSuper User
Hi, lastnn30
Create a measure to evaluate it:
LowestCountHighlight =
var ValuesDisplay =
CALCULATETABLE(
ADDCOLUMNS(
SUMMARIZE(SafetyData, SafetyData[Injury Location],SafetyData[Incident Type]),
"CountOfIncidentTYpe", CALCULATE(COUNTROWS(SafetyData), ALLEXCEPT(SafetyData, SafetyData[Injury Location]))),
ALLSELECTED()
)
var MinCOunt = CALCULATE(MINX(ValuesDisplay, [CountOfIncidentTYpe]))
var MaxCount = CALCULATE(MAXX(ValuesDisplay, [CountOfIncidentTYpe]))
var CurrentValue = COUNTROWS(SafetyData)
var Result =
SWITCH(TRUE(),
CurrentValue = MinCOunt, "#F00",
CurrentValue = MaxCount, "#0F0"
)
return Result
Then use - Field Value in the Conditional formatting:
Or if you wanna have more control, you can return 1 and 2 (1 = min, 2 = max) and then in Conditional formatting -> Rules, you can setup the colors accordingly (if value = 2 then some color etc.)