Using SVGs in Power BI is a game-changer when it comes to creating custom visuals. For example, I designed a progress bar that already includes text and a percentage, something that would require multiple visual elements if done with native Power BI visuals. The beauty of using SVGs is not just in the customization, but also in the ability to reuse your custom SVGs across multiple reports, saving you time and effort.
So let's get started with creating your own Porgress Bar!

Ask Chat GPT
In times like these, it's important to use any available tools to boost your productivity. Let’s leverage ChatGPT to help create the required code.

The Answer:
Further adaptions

The Answer:

The Answer:

The Answer:

The Answer:
The final SVG
SVG Auftraege Progress =
VAR Width = 500
VAR Height = 25
VAR ActualWidth = 400 * DIVIDE([Sum Auftraege verrechnet],[Sum Auftraege])
VAR WidthOpen = 400
Var FontSize = 14
VAR ColorBarActual = "#4197AB"
VAR ColorBarOpen = "#D0D0D0"
--- Progress Bar Info ---
VAR PERCENTAGEFILL = DIVIDE([Sum Auftraege verrechnet],[Sum Auftraege]) * 100
RETURN
"data:image/svg+xml;utf8," &
"<svg width=' "& Width &" ' height=' "& Height &" ' viewBox='-2 -2 "& Width &" +40 "& Height &" +2 ' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' display= 'block' overflow='visible'>
<rect id='track' x='' y='-2' rx='0' ry='0' width=' "& WidthOpen &" ' height= ' "& Height &" ' fill=' "& ColorBarOpen &" ' />
<rect id='fill' x='0' y='-2' rx='0' ry='0' width="& "'"& ActualWidth &"'"&" height=' "& Height &" ' fill='"& ColorBarActual &"'></rect>
<use href='#mySymbol' x='0' y='-2' style='opacity:1.0' />
<text x='410' y='15' font-size = ' "& FontSize &" ' font-weight='medium' font-family='Tahoma' >"&FORMAT(PERCENTAGEFILL/100, "0%")&"</text>
</svg>"
Adapt Data Type
The last step is adpating the data type of the SVG in Power BI to Image URL. Now you can use it in a table, a matrix or a card visual.
Summary
I hope you had as much fun as I had with playing around with generating code for SVGs . And hopefully you will apply this technic to create your own visuals!
Cming soon: More Posts you might enjoy
😍 From LinkedIn to Insights: Building Dashboards for Personal Branding

COMING SOON
Write a comment