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
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

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
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.

Top Solution Authors