Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
speedramps
Super User
Super User

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 

speedramps_0-1720268231184.png

 

1 ACCEPTED SOLUTION
shafiz_p
Resident Rockstar
Resident Rockstar

@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..

shafiz_p_0-1720281819111.png

 

 

Hope this help!!

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

View solution in original post

7 REPLIES 7
shafiz_p
Resident Rockstar
Resident Rockstar

@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..

shafiz_p_0-1720281819111.png

 

 

Hope this help!!

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

Thank you @shafiz_p 

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

Many thanks an well done !

ThxAlot
Super User
Super User

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,

ThxAlot_0-1720277017809.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



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. 👍

elitesmitpatel
Solution Supplier
Solution Supplier

Navigate through the image to reach the setting  and understand the rule 

elitesmitpatel_0-1720275948807.png


Link of solved PBIX
Calculation group colour Solved 

Accept it as Solution  if it helps you , that will help the community also.
Thanks

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. 

speedramps_0-1720281392434.png

 

elitesmitpatel
Solution Supplier
Solution Supplier

Refer the images
1) navigate through image

elitesmitpatel_0-1720272365082.png

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.

elitesmitpatel_1-1720272473041.png


Here is the link Calculating group colour  

Please accept it as Solution if it helped you.
Thanks

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.