Forum Discussion

manojk_pbi's avatar
manojk_pbi
Helper V
2 years ago
Solved

Need help in adding conditional font/background color

Hi, 

I have data like below in a table RunRate is a measure. I would like add folor color based on logic. Pls help me how can it be done.

idealRunrate : 33% 

idealRate +/- 5% tollerance

IdealRate = 33+5 = 38% & 33-5 = 28%

Logic for font color - RunRate >= 28% && <=38% -> Green, Red

PRJOECTS#PrjRun Rate
PRJOJECT11834%
PRJOJECT21139%
PRJOJECT31227%
PRJOJECT4833%
PRJOJECT5936%
PRJOJECT6434%
PRJOJECT72536%
PRJOJECT81234%
PRJOJECT91336%
PRJOJECT10943%
PRJOJECT11846%
PRJOJECT12432%
PRJOJECT13 0%
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  manojk_pbi ,

     

    Here are the steps you can follow:

    1. Create measure.

    Color =
    var _idealRunrate=0.33
    var _addidealRate=0.38
    var _idealdecrease=0.28
    return
    IF(
        MAX('Table'[RunRate]) >= _idealdecrease&&MAX('Table'[RunRate])<=_addidealRate,
        "Green","Red")

    2. Conditonal formatting – Background color.

    3. Background color – RunRate.

    Format style – Field value/

    What filed should we base this on – [color]

    4. Result:

     

    Best Regards,

    Liu Yang

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

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  manojk_pbi ,

     

    Here are the steps you can follow:

    1. Create measure.

    Color =
    var _idealRunrate=0.33
    var _addidealRate=0.38
    var _idealdecrease=0.28
    return
    IF(
        MAX('Table'[RunRate]) >= _idealdecrease&&MAX('Table'[RunRate])<=_addidealRate,
        "Green","Red")

    2. Conditonal formatting – Background color.

    3. Background color – RunRate.

    Format style – Field value/

    What filed should we base this on – [color]

    4. Result:

     

    Best Regards,

    Liu Yang

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

     

  • Ray_Minds's avatar
    Ray_Minds
    Solution Supplier

    Step 1: - Right click on the measure/column for which you would like to apply
    the formatting rule

    Step 2: - In our scenario, we need to apply a conditional
    formatting on Font color which can be selected by right clicking on the conditional
    formatting option: -

    Step 3: - Apply the below logic and click on OK.

                               
    Output : -




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