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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
cn4422
Helper V
Helper V

Calculation Group - conditional formatting

Hi,

 

I have a matrix table with one value and a calculation group for different time periods + calculations.

 

What I want is to put conditional formatting on the marked columns in red with + and - signs (see screenshot)

However, I cannot "select" (or don't know how to) those columns because they belong to a calculation group.

 

I tried to create a color-measure and then select with conditonal formatting (field) this measure, but it didn't work either:

 

measure_color=
VAR ChangeValue = SELECTEDMEASURE()
RETURN
    SWITCH(
        TRUE(),
        ChangeValue > 0, "#008000"
        ChangeValue < 0, "#FF0000"
    )

 

Any ideas are highly appreciated! 🙂

Thanks!

 

 

2025-02-11 16_05_44-Spielwiese _ Microsoft Whiteboard.png

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@cn4422,

 

Try rewriting your measure like this:

 

measure_color =
VAR ChangeValue = [Count Forms Category]
VAR Result =
    IF (
        SELECTEDVALUE ( 'Calc Group'[name] ) IN { "MyCalcItem1", "MyCalcItem2" },
        SWITCH ( TRUE, ChangeValue > 0, "#008000", ChangeValue < 0, "#FF0000" )
    )
RETURN
    Result

 

The concept is to wrap the logic in an IF statement that determines if a matrix column is one of the calculation items that needs formatting. The limitation of this approach is that you have to specify the measure name. SELECTEDMEASURE is a calculation item placeholder so it won't work in a measure. Here's a helpful video:

 

https://www.youtube.com/watch?v=MbxJ1oHHyTg 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
DataInsights
Super User
Super User

@cn4422,

 

Try rewriting your measure like this:

 

measure_color =
VAR ChangeValue = [Count Forms Category]
VAR Result =
    IF (
        SELECTEDVALUE ( 'Calc Group'[name] ) IN { "MyCalcItem1", "MyCalcItem2" },
        SWITCH ( TRUE, ChangeValue > 0, "#008000", ChangeValue < 0, "#FF0000" )
    )
RETURN
    Result

 

The concept is to wrap the logic in an IF statement that determines if a matrix column is one of the calculation items that needs formatting. The limitation of this approach is that you have to specify the measure name. SELECTEDMEASURE is a calculation item placeholder so it won't work in a measure. Here's a helpful video:

 

https://www.youtube.com/watch?v=MbxJ1oHHyTg 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@DataInsights  Thank you very much - also for the Video, awesome stuff! ^^

I put in the following measure and it worked fine:

One Measure Cond Format =
IF(
    SELECTEDVALUE('CalcGroup'[Name]) IN {"Δ LY", "Δ LY in %"},
    [Count Forms Category],
    BLANK()
)

@cn4422,

 

Glad to hear it worked!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.