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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register 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
Super User
Super User

@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

8 REPLIES 8
shafiz_p
Super User
Super User

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

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

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.LearnAndPractise(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
Super User
Super User

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
Super User
Super User

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.