Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Isuue with Conditional Formatting withIin calculation groups

Hello Everyone !

 

I have started using calculation goups and i'm trying to apply conditional formatting to some columns. However, it is working for one case and not another.

 

I have the a calulation goup that contains 8 calculations items and I would like to color the bouground of only the 3 colomuns (Month, YTD  Avg, YTD )  from this calculation groups. Therefore, I have created the measure [ConditionalF_Acticity] that returns the metric value when the colomun is selected, else blank . 

 

 

 

 

 

 

 

 

 

 

 

 

I have applied the following rules that is based on the created measure and not the calculation goup selected value

 

And the result is the following 

I'm really puzzled and don't understand why it's actually changing the background for the coloumns where i specified it to return blank but at the same time it's only applying the rule to the column that I specfied to return a value in the switch statement.

 

PS: I have applied the same logic to a different table (different data set) that contains a calculation group with 3 items all of type percetange and it's working perfectly ( formatting only 1 specific item out of the 3).

 

I'm looking forward to hearing your feedbacks 

 

Thanks in advance, 

Mariem,

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi aj1973

    I tried to implent your solution and it didn't work. The only way to get the result that I wanted to change my DAX formula to include the follwing check for each calculation item 

     

     

     

     

    Thanks again for the help !

  • aj1973's avatar
    aj1973
    Icon for Community Champion rankCommunity Champion

    Salut Anonymous 

    Your thread is very confusing to me as well! the [CoditionalF_Acticity] can only return values into one Column. However I think you want to spread the Return (Switch) result into 8 columns!! Not possible. Then you want to add conditional formating to a measure into only 1 column! the SELECTEDVALUE also, that column how many values that is looking for inside the column!

    Why don't apply the Conditional formating of your 8 Calculations on each of them one by one inside your visual?

     

    Trop de confusion Mariem ðŸ˜‰

     

    Can you share a Dummy/Sample of your PIBX file! It can help me better to assist you.

     


     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello aj1973 

       

      Thanks for taking the time to read and answer my post

      However, I'm not sure that I quite fully understand your recommendation.

      I don't want to apply the conditional formatting to all colomuns, I just need specific ones, and since there is no "direct" use of formatting colomuns with calculation groups ( i'm not using measures but calculations groups), I have tried to use the method indicated in this blog.

      https://exceed.hr/blog/conditional-formatting-with-calculation-groups-in-powerbi-matrix-visual/ 

       

      This method is actually working in one case but not in the other so I tried to tweek it a bit and use SWITCH instead of IF so that the conditional formatting is applied to the specfic colomun and ignored for the rest

       

      I hope the link to the blog will make my request a bit less confusing 🙂

       

      Kind Regards,

      Mariem,

       

      • aj1973's avatar
        aj1973
        Icon for Community Champion rankCommunity Champion

        Hi Anonymous 

        Indeed the link helped me to get away from my confusion lol.

        I tried to replicate both of your formulas into my Model and it all worked fine

         

        In the window of the 

         

         

        You need to close the condition by another Rule "else". In your Model there are numbers > 400 so by default the switch doesn't return Blank() it returns the default color "Bleu ciel".

         

        I think by adding a rule you can get what you want.

         

        It sounds like you made Power Bi getting confused ðŸ˜‰

         

         

         

         

  • aj1973's avatar
    aj1973
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    Has this issue been solved? If so, please mark it as is for the rest of the community to know.

    Thanks

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    I also am in search for the resolution on similar issue.

    The Situation is somewhat similar to what you are facing and also explained in the url link provided. In brief, I want to apply Conditional Formatting for background color on one of the Calculation Item "Actual" (Sold Units, Revenue, Cost etc.) from the CG, based on the value of another Calculation Item "Vs Target" (deviation from Target KPI) from same CG.

     

     

    So the Calaculation Item "Vs Target" calculated the current Actual KPI deviation from the quarterly target KPI, and color code the "Current Quarter KPI" in the threshold values eg. 0 or negative - Green, 0 - 2.5% - Yellow and so on. 

     

    Any clue how to achieve that?