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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Rygaard
Resolver I
Resolver I

Conditional Formatting Using Icons In Power BI - SVG NOT the build in icons

So your PR asked me to use corporate color palette for our power bi Embeded RED/Yellow/Green for a visaual representation of our items in stock.

 

I have tried a number of aproaches that i could not get to work

1) 

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

No matter what i do i could not get it to show the new colours.

2)

https://www.youtube.com/watch?v=hxzeA6PDU4Y&t=91s

the nested IF did NOT work for me

 

Here is what did work

Icon Set Measure 3 = 
Var svgStart = "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'>"
var svgFinish = "</svg>"
// above is start and finish that is the same for ALL SVG graphics. they are in a VAR ONLY to make the SWITCH more readable 
var res= SWITCH (
    TRUE (),
         [##Sum_Stock] > SUM('RGS Item_Stock_sums'[IS_Stock_Tolerance]), svgStart & "<circle cx='50' cy='50' r='40'  stroke='#5D6E5A' stroke-width='4' fill='#5D6E5A' />" & svgFinish,
         [##Sum_Stock] > SUM('RGS Item_Stock_sums'[IS_Stock_Tolerance])/2, svgStart & "<circle cx='50' cy='50' r='40' stroke='#C49949' stroke-width='4' fill='#C49949' />"& svgFinish,
                                                                           svgStart &"<circle cx='50' cy='50' r='40' stroke='#814539' stroke-width='4' fill='#814539' />" & svgFinish
    
)
return res

 

To get this to work you need to do 3 things after makeing your new meassurement

1 ) set the datatype to Text

2) set the data category to Image URL

3) after you added it to your matrix, remember this is an image, so search for image size and resize it to 30 by 30

Rygaard_0-1678792826772.png

 

Now you can drag it into a matrix and use it like any other meassure.

 

 

you can also do other shapes.... you can even draw your own shapes in SWG and use that

 

0 REPLIES 0

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.