Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Problem with a Measure Used for Conditional Formatting

Please help!

 

I successfully used the following measure for backgorund conditional formatting:

 

Color Measure = Switch(true(), MAX('WTCV'[OBL %]) >=.98 , "light green",
MAX('WTCV'[OBL %]) >=.92 , "yellow",
MAX('WTCV'[OBL %]) >=0 , "red"
)
 Used it as Field Value this way:

It works fine, no problem.

On another tab I have a nearly identical viasual, using nearly identical Excel file. So I set up another measure:

 

Obs Color Measure = Switch(true(), MAX('RDTE'[OBL %]) >=.98 , "light green",
MAX('RDTE'[OBL %]) >=.92 , "yellow",
MAX('RDTE'[OBL %]) >=0 , "red"
)
 
However, when I try to use it for conditional formatting, I am unable to select it. Please tell me what am I doing wrong.
  • negi007's avatar
    negi007
    5 years ago

    Anonymous 

     

    1. this is how i created measure in this case

     

    Color Measure = Switch(true(), MAX('Table'[OBL %]) >=.98 , 1,
    MAX('Table'[OBL %]) >=.92 , 2,
    MAX('Table'[OBL %]) >=0 , 3
    )
     
    2. then i used it in the conditional formatting like below
     

     

    3. below is the output

     

     

    I am also attaching pbix file for your. there are two measure in the file for background color based on condition.

     

    let me know if it helps you. thanks

7 Replies

  • Anonymous , Yiu can face issues when you do have text type of measure.  Just try to type Obs in search and then try to select.

    or

     Can you share a sample pbix after removing sensitive data.

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak 

      Still doesn't recognize the measure. May I send you the pbix via messenger?

  • negi007's avatar
    negi007
    Community Champion

    Anonymous there is another way of creating measures.If possible, please try below option instead of hard coding the color, use 1,2, 3 . Then instad of field value use rules in your conditional formatting. Please refer to below screenshot. This will also give you more control on the color scale you wish to use.

     

    Color Measure = Switch(true(), MAX('WTCV'[OBL %]) >=.98 , 1,
    MAX('WTCV'[OBL %]) >=.92 , 2,
    MAX('WTCV'[OBL %]) >=0 , 3
    )

     

     

    Do let me know if you still face any issue.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      negi007 Thank you! This sounds like a great method, however, I am not sure how you are using the measure in this case.

      • negi007's avatar
        negi007
        Community Champion

        Anonymous 

         

        1. this is how i created measure in this case

         

        Color Measure = Switch(true(), MAX('Table'[OBL %]) >=.98 , 1,
        MAX('Table'[OBL %]) >=.92 , 2,
        MAX('Table'[OBL %]) >=0 , 3
        )
         
        2. then i used it in the conditional formatting like below
         

         

        3. below is the output

         

         

        I am also attaching pbix file for your. there are two measure in the file for background color based on condition.

         

        let me know if it helps you. thanks

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi Anonymous ,

    Could you pls share your pbix file? Remember to remove condient data.

     

    Best Regards

    Lucien