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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
lastnn30
Post Patron
Post 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 appreciated. Thank you very much.

 

SNAG-0593.jpg

1 ACCEPTED SOLUTION
vojtechsima
Super User
Super 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:

vojtechsima_0-1650138515283.png

vojtechsima_1-1650138567924.png

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.)






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @lastnn30 ,

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team _ kalyj

vojtechsima
Super User
Super 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:

vojtechsima_0-1650138515283.png

vojtechsima_1-1650138567924.png

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.)






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.