Forum Discussion

speedramps's avatar
speedramps
Icon for Super User rankSuper User
2 years ago
Solved

How to apply conditional colour formatting to Calculation Groups dynamically with Field Parameters?

How to apply conditional colour formatting to Calculation Groups dynamically with Field Parameters?

Please only reply if you know the answer.

Click here to see example PBIX 

 

It has a Field Parameter for measures:-

  • Units sold
  • Value of sales
  • Packaging cost
  • Products sold

Then a Calculation Group with Calculation Items for:-

  • TY = this year
  • PY = previous year
  • YoY = year on year difference (PY – TY)
  • YoY%  =  difference %

The first matrix has Units and conditional colour formatting which works ok if amount is below zero.

The second matrix has Values and conditional colour formatting which works ok if amount is below zero.

The third matrix has a Field Parameter. How can I apply the conditional colour formatting if amount is below zero.

 

I want to learn how to apply conditional colour formatting to Calculation Groups dynamically with Field Parameters.

Thank you

 

Click here to see example PBIX 

 

  • speedrampsPlease use the below measure in the matrix value section instead of field parameter.

    Color Measure =
    VAR _selectedValue = SELECTEDVALUE('Calculation group'[Calculation item])
    RETURN
        SWITCH (
            TRUE(),
            _selectedValue IN {"PY", "TY","YoY","YoY%"} && MAX('Field parameter'[Parameter Name]) = "Units", [Units],  
            _selectedValue IN {"PY", "TY","YoY","YoY%"} && MAX('Field parameter'[Parameter Name]) = "Value", [Value],   
            _selectedValue IN {"PY", "TY","YoY","YoY%"} && MAX('Field parameter'[Parameter Name]) = "Packaging", [Packaging],  
            _selectedValue IN {"PY", "TY","YoY","YoY%"} && MAX('Field parameter'[Parameter Name]) = "Products", [Products]
            BLANK()   // Default case (no selection)
        )

    and then set the conditional formatting as the given picture by right clicking on the color measure. And you are done..

     

     

    Hope this help!!

    If this post solved your problem, please mark it as a solution!!

8 Replies

    • speedramps's avatar
      speedramps
      Icon for Super User rankSuper User

      Thanks elitesmitpatel   I have alreday tried that. It works and mght be the best workaround until PBI develop a better solution. I will accept solutin if noone has a better method. 

       

  • I doubt such a possibility of the current version of PBI; so far, it's necessary to manually choose the option(s) in this menu for conditional formatting,

    • speedramps's avatar
      speedramps
      Icon for Super User rankSuper User

      Thanks ThxAlot  I have alreday tried that. It works and mght be the best workaround until PBI develop a better solution. I will accept solutin if noone has a better method. 👍

  • speedrampsPlease use the below measure in the matrix value section instead of field parameter.

    Color Measure =
    VAR _selectedValue = SELECTEDVALUE('Calculation group'[Calculation item])
    RETURN
        SWITCH (
            TRUE(),
            _selectedValue IN {"PY", "TY","YoY","YoY%"} && MAX('Field parameter'[Parameter Name]) = "Units", [Units],  
            _selectedValue IN {"PY", "TY","YoY","YoY%"} && MAX('Field parameter'[Parameter Name]) = "Value", [Value],   
            _selectedValue IN {"PY", "TY","YoY","YoY%"} && MAX('Field parameter'[Parameter Name]) = "Packaging", [Packaging],  
            _selectedValue IN {"PY", "TY","YoY","YoY%"} && MAX('Field parameter'[Parameter Name]) = "Products", [Products]
            BLANK()   // Default case (no selection)
        )

    and then set the conditional formatting as the given picture by right clicking on the color measure. And you are done..

     

     

    Hope this help!!

    If this post solved your problem, please mark it as a solution!!

    • speedramps's avatar
      speedramps
      Icon for Super User rankSuper User

      Thank you shafiz_p 

      I will accept that as a solution but leaving the ticket open for more answers.

      Many thanks an well done !

    • anamika_singh's avatar
      anamika_singh
      Frequent Visitor

      Hello,

       

      This is a good workaround, however it din't work when i selected multiple measures in the field parameter. It works for single measure selected from the field parameter at a time. Any suggestions on how to fix this issue?

       

      Thanks,

      Anamika

  • elitesmitpatel's avatar
    elitesmitpatel
    Icon for Solution Supplier rankSolution Supplier

    Refer the images
    1) navigate through image

    2) Now after clicking on fx . You will see this pop up which says 1) type of condition  2) on which you want to apply and 3 ) here is the condition in which the values which is applied on  2) point  which you selected it says that the value > = in % and  < 0 in number will have Red  colour.


    Here is the link Calculating group colour  

    Please accept it as Solution if it helped you.
    Thanks