Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Conditional formatting not working on measure

I used EnterData in PBIDesktop and put just 3 rows there in just 1 column - Column1. I then made a Measure1 = SUM(Table1[Column1])

 

When I put Column1 in a table and add condional formatting to it, it works fine. In the screenshot below, you can see that "-17" is in red and "1" and "12" are in blue - as expected.

 

However, when I put Measure1 in a table and add same condional formatting to it, it does not work. As you can see in the screenshot below, the "-4" should have been in red color.

My PBIDesktop version is 2.65.* - which is a Dec2018 release

 

Any ideas how to get the Measure1 working with ConditionlFormatting?

 

 

 
  • MFelix's avatar
    MFelix
    6 years ago

    Hi Anonymous  and natabird3 

     

    I was responding to the post below and got your post also.

     

    https://community.powerbi.com/t5/Desktop/Conditional-Formatting-Quirks/m-p/929788/highlight/false#M445561

     

    As refered by v-juanli-msft mMeasure are based on context so when you have the calculation of the measure without reference to any other calcuttion the aggregation doesn't return any background colour.

     

    Believe that is the behaviour of the table visualization since you can add different levels of context and by default it's summarized with totals if you had an additional level of context as it's refered by adding the column 1 the formatting is applied.

     

    If you use the condittional formatting on a card or a bar chart since the context is based on the slicer and on that visualization it will work correctly.

     

    I agree that this is not user friendly and doesn't make sense. I will put an issue on the forum refering to this.

     

8 Replies

  • natabird3's avatar
    natabird3
    Skilled Sharer

    Not working for me either, i tried to add conditional formating on a matrix when using a measure and it was not applying the formating properly. Any ideas when this would be fixed, seems a basic feature?

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

    Hi Anonymous

    As tested with the lastest version 2.66.5376.1681 64-bit (February 2019)

    since when you add only one measure in the table, it is aggregated.

    Conditional formatting doesn't support for any aggregation value.

     

    As a workaround, i create a measure2, 

    Measure 2 = CALCULATE(SUM(Table1[Column1]),ALL(Table1))

     

    Best Regards

    Maggie

     

    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for responding v-juanli-msft

       

      I tried in my real dashboard. I have 3 measures as below:

       
      • msr_TotalSalary&Wages_Actual = CALCULATE( SUM(vAcctSumryBS[Dr_Cr]) , vAcctSumryBS[Category] ="Salary & Wages")
      • msr_TotalSalary&Wages_Forecast = CALCULATE( SUM(vAcctSumryBS[ForecastAmt]) , vAcctSumryBS[Category] ="Salary & Wages")
      • msr_TotalSalary&Wages_Variance_AvF = [msr_TotalSalary&Wages_Actual] - [msr_TotalSalary&Wages_Forecast]
         
        The value of msr_TotalSalary&Wages_Variance_AvF is negative. When I apply rule based formatting to it, it still does not change its color. I have checked it in Desktop Feb release as well. I tried it against a high number for msr_TotalSalary&Wages_Actual as well. It does not change colors. 
         
        Your expression for your measure is similar to mine, and yet I do not get the colors. Only difference I see is that you are using ALL. 
        Can you please help again?
      • MFelix's avatar
        MFelix
        Super User

        Hi Anonymous  and natabird3 

         

        I was responding to the post below and got your post also.

         

        https://community.powerbi.com/t5/Desktop/Conditional-Formatting-Quirks/m-p/929788/highlight/false#M445561

         

        As refered by v-juanli-msft mMeasure are based on context so when you have the calculation of the measure without reference to any other calcuttion the aggregation doesn't return any background colour.

         

        Believe that is the behaviour of the table visualization since you can add different levels of context and by default it's summarized with totals if you had an additional level of context as it's refered by adding the column 1 the formatting is applied.

         

        If you use the condittional formatting on a card or a bar chart since the context is based on the slicer and on that visualization it will work correctly.

         

        I agree that this is not user friendly and doesn't make sense. I will put an issue on the forum refering to this.