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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
saud968
Super User
Super User

Conditional Formatting in matrix visual

Conditional formatting for an average of % in the matrix visual is not working... 0-4% should be green 5-10% in yellow and 11% above in red. You can review the screenshot below

saud968_0-1701090627148.png


Abandon % is calculated column - 

Abandon % = IF(support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG] = 0, 0, support__cw_ops_manage_case_merge_temp[Total_Chat_Count] / support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG])

saud968_1-1701090631274.png

 

@lbendlin @Ahmedx 

1 ACCEPTED SOLUTION

Never Mind I was able to fix it, I changed the value a decimal number and found that in the rules i should use 0.04 and further so once it was fixed I changed it back % and it is working fine. Thank you for all your help

View solution in original post

19 REPLIES 19
Ahmedx
Super User
Super User

try this

CF = SWITCH( TRUE(),
    [Abandon %] <= 0.04,"#008000",
    [Abandon %]<= 0.1 ,"#FFFF00",
    "#FF0000"
      )
Ahmedx
Super User
Super User

you need to crate measure

 

 

 

CF = SWITCH( TRUE(),
    [Abandon %] <= 0.04,"#008000",
    [Abandon %]<= 0.1 ,"#FFFF00",
    "#FF0000"
      )

 

 

 

and then follow the pictures
Screenshot_1.pngScreenshot_2.png

I tried this and followed the screenshot given by you

 

ColorCategory =
VAR AbandonPercentage = AVERAGE(support__cw_ops_manage_case_merge_temp[Abandon %])
RETURN
    SWITCH(
        TRUE(),
        AbandonPercentage >= 0 && AbandonPercentage <= 4, "Green",
        AbandonPercentage > 4 && AbandonPercentage <= 10, "Yellow",
        AbandonPercentage > 10, "Red",
        BLANK()  
    )


but I am getting the below 

saud968_2-1701092912293.png

 

значение матрице как вы посчитали?
вот так AVERAGE(support__cw_ops_manage_case_merge_temp[Abandon %])

Abandon % = IF(support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG] = 0, 0, support__cw_ops_manage_case_merge_temp[Total_Chat_Count] / support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG])
i used this measure

why do you use conditional
AVERAGE(support__cw_ops_manage_case_merge_temp[Abandon %])
------------------
this is incorrect, needs to this
CF = SWITCH(TRUE(),
[Abandon %] <= 0.04,"#008000",
[Abandon %]<= 0.1 ,"#FFFF00",
"#FF0000"
)

 Because this column - support__cw_ops_manage_case_merge_temp[Abandon %] is not showing when only using switch. Also, I am trying to share the file as I have lower the file size as drive and other uploading sites are blocked and I have to email the file to myself and then upload and share

try this

CF = SWITCH( TRUE(),
    MAX(support__cw_ops_manage_case_merge_temp[Abandon %]) <= 0.04,"#008000",
    MAX(support__cw_ops_manage_case_merge_temp[Abandon %])<= 0.1 ,"#FFFF00",
    "#FF0000"
      )

I tried this 

CF = SWITCH( TRUE(), MAX(support__cw_ops_manage_case_merge_temp[Abandon %]) <= 0.04,"#008000", MAX(support__cw_ops_manage_case_merge_temp[Abandon %])<= 0.1 ,"#FFFF00", "#FF0000" )
it turned everything in red

the other 

CF = VAR _Abandon = IF(support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG] = 0, 0, support__cw_ops_manage_case_merge_temp[Total_Chat_Count] / support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG]) RETURN SWITCH(TRUE(), _Abandon <= 0.04,"#008000", _Abandon <= 0.1 ,"#FFFF00", "#FF0000")
It is not able to find the  support__cw_ops_manage_case_merge_temp[Total_Chat_Count] / support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG]) columns weird 

pls share the file

or this

ColorCategory =
VAR AbandonPercentage = AVERAGE(support__cw_ops_manage_case_merge_temp[Abandon %])
RETURN
    SWITCH(
        TRUE(),
        AbandonPercentage >= 0 && AbandonPercentage <= 0.4, "Green",
        AbandonPercentage > 0.4 && AbandonPercentage <= 0.1, "Yellow",
        AbandonPercentage > 0.1, "Red",
        BLANK()  
    )

pls try this

CF = SWITCH( TRUE(),
    [Abandon %] <= 0.04,"#008000",
    [Abandon %]<= 0.1 ,"#FFFF00",
    "#FF0000"
      )

saud968_0-1701092778834.png

saud968_1-1701092796779.png

Unfortunately, the Abandon % is not reflecting in the measure you suggested

I tried both but everything is going green

this does not show the calculated column so not working

CF = SWITCH( TRUE(),
    [Abandon %] <= 0.04,"#008000",
    [Abandon %]<= 0.1 ,"#FFFF00",
    "#FF0000"
      )



saud968_0-1701095572905.png
This is turning everything in green

ColorCategory =
VAR AbandonPercentage = AVERAGE(support__cw_ops_manage_case_merge_temp[Abandon %])
RETURN
    SWITCH(
        TRUE(),
        AbandonPercentage >= 0 && AbandonPercentage <= 0.4, "Green",
        AbandonPercentage > 0.4 && AbandonPercentage <= 0.1, "Yellow",
        AbandonPercentage > 0.1, "Red",
        BLANK()  
    )

 

pls try this

CF =
VAR _Abandon = 
IF(support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG] = 0, 0, support__cw_ops_manage_case_merge_temp[Total_Chat_Count] / support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG])
RETURN
SWITCH(TRUE(),
_Abandon <= 0.04,"#008000",
_Abandon <= 0.1 ,"#FFFF00",
"#FF0000")

you are doing something wrong, please share the file

This is the Google Drive link, I have copied the table on Excel and shared the Excel file - Please put the request for access - 

https://docs.google.com/spreadsheets/d/1QSRgpaE4NWsfASDQfBnSAc_YEMhIdKYZ/edit?usp=drivesdk&ouid=1093...


Total_Chat_Count = IF('support__cw_ops_manage_case_merge_temp'[Total_Chat_Count2] = "Chat", 1,0)
Total_Chat_Count2 = IF('support__cw_ops_manage_case_merge_temp'[CHAT_FLAG] = 1, "Chat", "Non-Chat")
Abandon % = IF(support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG] = 0, 0, support__cw_ops_manage_case_merge_temp[Total_Chat_Count] / support__cw_ops_manage_case_merge_temp[ABANDONED_CHAT_FLAG])
These are the measures for you that i used

I need a pbix file

Never Mind I was able to fix it, I changed the value a decimal number and found that in the rules i should use 0.04 and further so once it was fixed I changed it back % and it is working fine. Thank you for all your help

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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