Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Conditional color by product

Hi, how to create a measure to have the below color criteria? If the Product = Product A & [Average hours] > 30 then "red", if Product = Product B & [Average hours] > 25, "Red", else "Green"
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    Please try the measure below:

    Color Criteria = 
    SWITCH(
        TRUE(),
        SELECTEDVALUE( 'Table'[Product] ) = "A" &&SELECTEDVALUE('Table'[Average hours])> 30, "red",
    SELECTEDVALUE( 'Table'[Product] ) = "B" &&SELECTEDVALUE('Table'[Average hours])> 25,"red","green"
    )

     

    Then you can follow these steps to set font color.

    1.Click the column you want to apply the conditional color.

    2.Under the “Format by” options >choose Field value>

     

    3.Choose Color Criteria in "Based on field" pane and click ok.

     

    You will get a chart like below:

     

    A sample PBIX. for your reference is attached

     

    Hope it helps,


    Community Support Team _ Caitlyn Yan

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.