
SVG (Scalable Vector Graphics) is a great way to add a bit of flavor and pizzazz to your boring Power BI reports. I have been using them for a while and really love how easy and fun they are to work with. So today, let me share the technique and provide sample measure code that you can readily use to make your first SVG DAX graphic in Power BI.
What we are going to build – Demo of SVG DAX
We are going to create this rectangle bar chart with SVG. It is a simple graph that shows a KPI (ex: Attendance Percentage).

What you need?
- Any recent version of Power BI Desktop
- A measure or set of measures that you want to visualize with SVG
Creating your first SVG DAX Measure – Step-by-step Instructions
Step 1: Make a measure to visualize
If not already done, create a measure to visualize with SVG. In our example, we want to see attendance percentage as a rectangle. So I have the measure [attendance percentage]
in my model.
Attendance Percentage = DIVIDE([Total Attendance], [Total Days]) //Example KPI measure
Step 2: Create the SVG Measure
Create a new measure for our SVG. Use below code as starting point and customize it as per your model.
SVG Rectangle =
var att_pct = [Attendance Percentage] // your KPI goes here
var rect_width = 300 * att_pct // scaling the KPI to our SVG rectangle width. 100% = 300pixels
var att_pct_disp = FORMAT(att_pct, "0%") // formatting KPI to display inside the rectangle
return
"data:image/svg+xml;utf8,
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 60'>
<rect x='5.522' y='4.682' width='"&rect_width &"' height='50' style='fill:#DE913A; stroke: rgb(0, 0, 0);' rx='5.277' ry='5.277'/>
<text style='fill: #111111; font-family: "Arial", sans-serif; font-size: 28px; font-weight: 700; white-space: pre;' x='14.165' y='40.696'>"&att_pct_disp&"</text>
</svg>"
Step 3: Set Measure Category to Image URL

Now that we have the [SVG Rectangle] measure in our model,
- Select the
[SVG Rectangle]
measure - Go to Measure Tools > Data Category
- Set it to Image URL
Boom! Now your table or matrix will show SVG bars
Step 4: Use the SVG Measure inside a visual
Set up a table / matrix visual. Add your SVG rectangle measure to the visual and we can instantly see the rectangles drawn. See this quick demo.

Which Visuals can I use to see SVG Images?
Currently (as of May 2025), the below Power BI visuals are supported for SVG based DAX measures.
- Table
- Matrix
- New Card Visual (sometimes buggy)
- New Button Slicer Visual
SVG DAX Measures – Video Tutorial
I made a detailed explanation of SVG measures with few different examples and code explanation. You can watch it below or on my YouTube channel.
Sample File – SVG DAX Measures
Click here to download Sample Power BI Workbook with the SVG DAX measure examples. Customize the measures or create new to learn how to apply this technique. Checkout the SVG Project on my Github for all the other files and additional resources.
When and Why Use SVG?
SVGs let you:
- Build pixel-perfect visuals in Power BI
- Avoid external custom visuals
- Add creative KPIs (think calendar heatmaps, progress bars, mini-charts, and more)
- Control layout and formatting via code
Watch Out For…
- Performance: SVGs add some overhead, especially with large datasets.
- Measure length: Power BI has limits (~32k characters per measure).
- Visual support: Works best in tables and matrix visuals; new card visuals are hit-or-miss.
- Tooltips: Without customization, Power BI may show raw SVG code as tooltip.
Pro Tips
- Use a tool like Boxy SVG Editor to design and export SVGs
- When copying SVG code from elsewhere, Replace all
"
with'
to simplify embedding in DAX - Explore SVG templates from Kerry Kolosko to fast-track your visuals
What’s Next?
This is part 1 of my SVG + DAX journey. In the next post, we’ll break down a full SVG-powered attendance dashboard—calendar heatmap, employee cards, and all. We are going to build this in the next part:

Until then, experiment and impress your colleagues with a whole new level of custom Power BI visuals.