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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Icon Conditional Formating using DAX to find Value

Hello Community, 

 

I am trying to add the icon to my column SP data feed matrix [OVERALL_RATING] which have 4 value

Acceptable, Marginal, VALUE MISSING, Not Acceptable. 
The ending result, I would like to assign which of them with according color 
Circle green, Triangle Yello, Star Grey, Circle Yellow. 
Here is the sample of the data in Power BI. and the ending result that i wanted 
image.png
image.png
 
Here is my attempted DAX code 
 
Icon Set Measure =
SWITCH(
TRUE(),
'SP data feed matrix'[OVERALL_RATING] = Acceptable, "circle cx=’50’ cy=’50’ r=’40’ stroke=’green’ stroke-width=’4′ fill=’green’ /",
'SP data feed matrix'[OVERALL_RATING] = Marginal, "circle cx=’50’ cy=’50’ r=’40’ stroke=’yellow’ stroke-width=’4′ fill=’yellow’ /",
'SP data feed matrix'[OVERALL_RATING] = "VALUE MISSING", "circle cx=’50’ cy=’50’ r=’40’ stroke=’red’ stroke-width=’4′ fill=’red’ /",
'SP data feed matrix'[OVERALL_RATING] = "Not Acceptable", "circle cx=’50’ cy=’50’ r=’40’ stroke=’purple’ stroke-width=’4′ fill=’purple’ /",
"circle cx=’50’ cy=’50’ r=’40’ stroke=’white’ stroke-width=’4′ fill=’white’ /"
)
1 ACCEPTED SOLUTION

Hi @Anonymous 

 

I noticed that you didn't add the "" to include the text Acceptable,Marginal...in the dax expression. 

Here's icon formatting post probably could be your reference:

https://community.powerbi.com/t5/Desktop/Icons-Color-formatting/m-p/747856 

https://exceleratorbi.com.au/conditional-formatting-using-icons-in-power-bi/ 

If the problem still exists, Would you mind kindly share your dummy pbix? please make sure you've removed the confidential info before.I'd like to check it further.

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

In the format option of matrix visual, you have an option for icons under conditional formatting. Choose that and check advance option, if that can help.

Or refer

https://community.powerbi.com/t5/Desktop/Icons-Color-formatting/td-p/747856

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Thank you so much for your reply however I am trying to do conditional formatting using a text instead of whole number, I tried to copy exact the code and only change the color format but it will give me trouble. 

 

Here is my updated DAX it have the error code "The syntax for 'data' is incorrect"

 

OVERALL_RATING icon =
SWITCH (
TRUE (),
'SP data feed matrix'[OVERALL_RATING] = Acceptable , "data&colon;image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='100' height='100' viewBox='0 0 100 100'> <circle cx='50' cy='50' r='40' stroke='purple' stroke-width='4' fill='purple' /> </svg>",
'SP data feed matrix'[OVERALL_RATING]= Marginal, "data&colon;image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='100' height='100' viewBox='0 0 100 100'> <circle cx='50' cy='50' r='40' stroke='green' stroke-width='4' fill='dark green' />
'SP data feed matrix'[OVERALL_RATING]= "VALUE MISSING", "data&colon;image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='100' height='100' viewBox='0 0 100 100'> <circle cx='50' cy='50' r='40' stroke='green' stroke-width='4' fill='dark green' />
'SP data feed matrix'[OVERALL_RATING]= "Not Acceptable", "data&colon;image/svg+xml;utf8, <svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='100' height='100' viewBox='0 0 100 100'> <circle cx='50' cy='50' r='40' stroke='green' stroke-width='4' fill='dark green' />
</svg>",
)

Hi @Anonymous 

 

I noticed that you didn't add the "" to include the text Acceptable,Marginal...in the dax expression. 

Here's icon formatting post probably could be your reference:

https://community.powerbi.com/t5/Desktop/Icons-Color-formatting/m-p/747856 

https://exceleratorbi.com.au/conditional-formatting-using-icons-in-power-bi/ 

If the problem still exists, Would you mind kindly share your dummy pbix? please make sure you've removed the confidential info before.I'd like to check it further.

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!