Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Conditional formatting min & max

Hello, I would like to color the maximum data in a table in green and the minimum data in red. The table has 1500 rows and I want the formatting to be present on the "supplier" and "CA N" column, from the max and min value of the "Var.CA" column. Can you help me? THANKS. 

 

 

  • Hi Anonymous , you can use the measure below as basis to create the conditional formatting, then apply it in the columns you want to have the formatting using the option 'Field value', as shown below:

    Conditional Formatting = 
    
    VAR _max_value =
        MAXX(
            ALLSELECTED('Table'[Supplier]),
            [Var.CA]
        )
        
    VAR _min_value =
    MINX(
        ALLSELECTED('Table'[Supplier]),
        [Var.CA]
    )
    
    RETURN
        SWITCH(
            [Var.CA],
            _max_value, "Green",
            _min_value, "Red"
        )

     

     

     


    Hope this answer solves your problem!
    If you need any additional help please @ me in your reply.
    If my reply provided you with a solution, please consider marking it as a solution โœ”๏ธ or giving it a kudoe ๐Ÿ‘

    Thanks!

    Best regards,
    Joao Ribeiro

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you Joao!

  • joaoribeiro's avatar
    joaoribeiro
    Impactful Individual

    Hi Anonymous , you can use the measure below as basis to create the conditional formatting, then apply it in the columns you want to have the formatting using the option 'Field value', as shown below:

    Conditional Formatting = 
    
    VAR _max_value =
        MAXX(
            ALLSELECTED('Table'[Supplier]),
            [Var.CA]
        )
        
    VAR _min_value =
    MINX(
        ALLSELECTED('Table'[Supplier]),
        [Var.CA]
    )
    
    RETURN
        SWITCH(
            [Var.CA],
            _max_value, "Green",
            _min_value, "Red"
        )

     

     

     


    Hope this answer solves your problem!
    If you need any additional help please @ me in your reply.
    If my reply provided you with a solution, please consider marking it as a solution โœ”๏ธ or giving it a kudoe ๐Ÿ‘

    Thanks!

    Best regards,
    Joao Ribeiro