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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

October NL Carousel

Fabric Community Update - October 2024

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