Forum Discussion

lastnn30's avatar
lastnn30
Post Patron
4 years ago
Solved

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.

 

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

2 Replies

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

  • 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