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
Renna
Frequent Visitor

Conditional Formatting for specific level of matrix

Hi, 
I want to apply conditional formatting ('Field Value', based on a measure) to only the top level of a matrix, regardless of its state (collapsed/expanded). 
It works well when "Totals Only" is selected and the matrix is expanded

Renna_1-1711143201263.png

but the formatting disappears upon collapsing to the top level:

Renna_2-1711143271186.png

Here is the measure: 

KPI = IF(ISINSCOPE('Sample Table'[Project Group]),
IF( SUM('Sample Table'[Revenue]) > 1000000, "Green", "Red"), BLANK())

I'd appreciate any guidance on this.



1 ACCEPTED SOLUTION

@Renna 

the idea is that the DAX code you wrote  ( the isinscope part )  will always be true on all levels,  

because project group is the first level  , so all lower levels are inscope of the first level. 

 

modify you code to this : 

switch (

true() , 

isinscope( level 2 col of the matrix  ) , blank() , 

 ISINSCOPE('Sample Table'[Project Group]),

if ( SUM('Sample Table'[Revenue]) > 1000000, "Green", "Red")

)

 

 

NB :

you can use if statement . 

i prefer switch for readability . 

 
 
let me know if this works for you . 
 
 
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🙏

View solution in original post

4 REPLIES 4
Daniel29195
Super User
Super User

@Renna 

when applying the conditional formatting, 

apply it to total and values 

Daniel29195_0-1711143817591.png

 

hope this helps .

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🙏

Hi Daniel, 

Thanks for your response. When I select Values and Totals, it works well when the matrix is collapsed: 

Renna_0-1711144060231.png

But, it also applies to level 2, which I don't want: 

Renna_1-1711144117166.png

 

@Renna 

the idea is that the DAX code you wrote  ( the isinscope part )  will always be true on all levels,  

because project group is the first level  , so all lower levels are inscope of the first level. 

 

modify you code to this : 

switch (

true() , 

isinscope( level 2 col of the matrix  ) , blank() , 

 ISINSCOPE('Sample Table'[Project Group]),

if ( SUM('Sample Table'[Revenue]) > 1000000, "Green", "Red")

)

 

 

NB :

you can use if statement . 

i prefer switch for readability . 

 
 
let me know if this works for you . 
 
 
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🙏

It works! Thank you so much!

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.