Forum Discussion

Tomhayw's avatar
Tomhayw
Helper I
3 years ago
Solved

Conditionally formatting different columns based on the same values

Hi there,

 

I currently have a matrix with months as rows, job grades as columns and utilisation as the values. 

I want to conditionally format this so that lower utilisation is red and higher is green however the target utilisation for each grade is different.

Is there a way to set different conditional formatting rules for each column?

 

Thanks,

Tom

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Tomhayw ,

    Please try to create a measure with below dax formula:

    Measure =
    VAR cur_level =
        SELECTEDVALUE ( 'Table'[Level] )
    VAR cur_val =
        SELECTEDVALUE ( 'Table'[Value] )
    VAR val =
        SWITCH ( cur_level, "L1", 15, "L2", 30, "L3", 40 )
    VAR fnt_color =
        IF ( cur_val >= val, "green", "red" )
    RETURN
        fnt_color
    

    Set font color:

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Tomhayw ,

    Please try to create a measure with below dax formula:

    Measure =
    VAR cur_level =
        SELECTEDVALUE ( 'Table'[Level] )
    VAR cur_val =
        SELECTEDVALUE ( 'Table'[Value] )
    VAR val =
        SWITCH ( cur_level, "L1", 15, "L2", 30, "L3", 40 )
    VAR fnt_color =
        IF ( cur_val >= val, "green", "red" )
    RETURN
        fnt_color
    

    Set font color:

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Tomhayw's avatar
      Tomhayw
      Helper I

      Thanks, is there a way to do this with background colour instead of font colour?

       

      Thanks,

      Tom