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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NickHoffmans
Frequent Visitor

Separate conditional formatting on matrix subtotals and values

Hello, 
I have a matrix in which I want to apply to both the (sub)totals as well as on the values below. However, I would like to have the conditonal formatting applied separated from each other, in order to keep the (way higher) values from the (sub)totals out of the formatting of the values.

However, I don't see the possibility to have two distinct conditonal formats if I want both to be formatted in the same way (e.g., font color).

How can I make this happen?

 

Thanks!

8 REPLIES 8
mh2587
Super User
Super User

https://www.bluegranite.com/blog/controlling-conditional-formatting-using-dax follow this link for guidance 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



mh2587
Super User
Super User

Both.PNG


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



mh2587
Super User
Super User

There will be option "Apply to " in this select both the values and total option I hope this will help you


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



I am aware of the "apply to"-button. However, if click "Values and totals" it will count them together.

However, I would like to have two separate ranges (one range for "Values", one range for "Totals") to apply the different conditonal formats to.

Try to handle this with measure Just define the ranges and color codes in switch function may be this logic will resolve the issue 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



mh2587
Super User
Super User

Can you provide some details with screenshots or with something else , what you want 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Sure.

I do have two columns (turnover and costs) which I subtract to a third column: margin

Here, I put the conditional formatting on the "values"-level of 'margin'.

NickHoffmans_0-1636632453166.png

When putting it on "totals"-level of 'margin'

NickHoffmans_1-1636632592947.png

 

I woud like to have it applied to both the values and the totals together, but separately, since the "totals" are (obviously) way higher than the "values".

Hi @NickHoffmans,

 

It seems that it can not set the total color under conditional formatting. Only the Subtotals can set the total color without rules.

vchenwuzmsft_0-1637054345007.png

You can present an idea on the power bi ideas .

 

If I am wrong, please let me know. If you can set total font dynamically, some measures like the following  maybe work.

Measure =
VAR _s =
    SUM( 'Table'[Values] )
VAR _value =
    SWITCH(
        TRUE(),
        _s < 20, "red",
        _s >= 20
            && _s < 40, "yellow",
        _s >= 40, "green"
    )
VAR _total =
    SWITCH(
        TRUE(),
        _s < 100, "Purple",
        _s >= 100
            && _s < 300, "Orange",
        _s >= 300, "blue"
    )
RETURN
    IF( HASONEVALUE( 'Table'[Values] ), _value, _total )

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.