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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
elliejiang20
Microsoft Employee
Microsoft Employee

Waiting in hurry: Background color doesn't work correctly with 4 levels hierarchy in Matrix Table

There are 3 hierarchy levels for a Matrix table.

Why does background color which is controlled by Calculated column DAX and applied in conidiation formatting not take effect on the 2th level hierarchy, but works well after drill down to the 3th level hierarchy?
Not take effect means the background color can’t show correctly as per below background color DAX logic, the cell should be green shows red, red shows green:

(--#8DDCA0 green, #FD625E is red in below---)
BackgroundColor_Flag =

IF (TABL[Category]="NNA (in percentage)", IF(TABL[Value]>=95,"#8DDCA0","#FD625E"),

IF(TAB[Category]="#of missed",IF(TABL[Value]=0,"#8DDCA0","#FD625E"),IF(TABL[Value]<=15,"#8DDCA0","#FD625E")))

 

By the way, the "Values" in Matrix table configuration applied an another calculated column DAX to show some values in percentage, some in Number as below:

Valuewith% = if(TABL[Category]="NNA (in percentage)" ,FORMAT(TABL[Value]/100, "0.0%") ,Format(TABL[Value],"General Number"))

 

"Format style" in conditional formating is 'Filed Value' with DAX BackgroundColor_Flag, the "Summarization" is 'First'‘Last’. Whichever options for Matrix table and conditional formattting, background color still does work on the 3th level hierarchy. 

Please help to investigate.

3 REPLIES 3
elliejiang20
Microsoft Employee
Microsoft Employee

Not reslove yet

VijayP
Super User
Super User

@elliejiang20 
IF Formula doesnt look good! for each IF you need to give one result where as you have given the result after two if conditions , and this is causing confusion in DAX engine! Chekc that,

Better use Switch Function for better formula Construct!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


I just changed to Switch as below, the problem is till there, pls see attachement picture.

 

Tried 1):

BackgroundColor_Flag =
SWITCH(TABL[Category],
"NNA (in percentage)", IF(TABL[Value]>=95.0,"#8DDCA0","#FD625E"),
"#of missed",IF(TABL[Value]=0.0,"#8DDCA0","#FD625E"), ---#8DDCA0 is green
"Premium", IF(TABL[Value]<=15.0,"#8DDCA0","#FD625E"),
"Operation", IF(TABL[TTAValue]<=15.0,"#8DDCA0","#FD625E"))
elliejiang20_0-1644598980185.png

Tried 2):
By the way, the "Values" in Matrix table configuration applied an another calculated column DAX to show some values in percentage, some in Number as below, so Valuewith% column is text, don't think Dax can evaluate greater than and less than.

Valuewith% = if(TABL[Category]="NNA (in percentage)" ,FORMAT(TABL[Value]/100"0.0%") ,Format(TABL[Value],"General Number"))
So I change DAX to:
BackgroundColor_Flag = ---so Valuewith% column is text, don't think Dax can evaluate greater than and less than.
SWITCH(TABL[Category],
"NNA (in percentage)", IF(TABL[Valuewith%]>="95.0%","#8DDCA0","#FD625E"),
"#of missed",IF(TABL[Valuewith%]="0.0","#8DDCA0","#FD625E"),
"Premium", IF(TABL[Valuewith%]<="15.0","#8DDCA0","#FD625E"),
"Operation", IF(TABL[Valuewith%]<="15.0","#8DDCA0","#FD625E"))
Then looks below, not correct:
elliejiang20_1-1644599316685.png

 

elliejiang20_2-1644599545635.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors