Home>Blogs>Power BI>Power BI KPI Cards with SVG + DAX: Let AI Write Them (Free File)
Power BI

Power BI KPI Cards with SVG + DAX: Let AI Write Them (Free File)

Which coffee shops are behind target? On a plain card and a grey table nobody can tell in two seconds. In this tutorial you build Power BI KPI cards with SVG and DAX and let Claude write the measures: a KPI card with a sparkline, a progress bar, a bullet chart, a status pill and a target donut. It stays 100% native: no custom visual, nothing to install. The example is Summit Coffee Co., 12 coffee shops in Denver, Austin, Portland and Boise.

Power BI store scorecard before and after: plain cards and a grey table versus SVG KPI cards, progress bars, bullet charts and status pills
Before and after: the same report, with five SVG visuals written by Claude.

⬇️  Join Free on Skool & Download the Practice File
Free membership · takes 1 minute · the file is in Classroom → Free Downloads from YouTube
Practice + Solution .pbix · Summit Coffee data · AI prompt template · answer key · .zip · Power BI Desktop

Recap

  1. KPI card with a sparkline
  2. Progress bar
  3. Bullet chart
  4. Status pill column
  5. Target donut
Finished Summit Coffee store scorecard in Power BI with SVG KPI card, donut, progress bars, bullet charts and status pills
The finished store scorecard.

Tips for SVG Measures in Power BI

  • Always set Data category to Image URL, and use rgb() colours only.
  • Design every table image with the same height, because a table has one image size.
  • Keep the rules prompt at the top of each AI chat and test on a copy of your report.
  • If you publish to the Power BI service, test the table images there before you share the report.

Related tutorials: Restyle a Power BI report with a custom theme JSON and Dynamic conditional formatting in Power BI with one DAX measure. For more on SVG itself, see MDN’s SVG documentation.

Want a finished Power BI dashboard? See the Coffee Chains Dashboard in Power BI on NextGenTemplates.com. We also build custom Power BI and Excel dashboards on demand.

Frequently Asked Questions

How do I make Power BI KPI cards with SVG?

Write a DAX measure that returns text starting with data:image/svg+xml;utf8, followed by an <svg> element, set the measure's Data category to Image URL, then show it in the built-in Image visual or in a table column. Claude (or any AI chat) can write the measure if you give it a clear rules prompt.

Do I need a custom visual or the HTML Content visual?

No. The method uses only the built-in Image and Table visuals, so there is nothing to install and nothing for IT to approve.

Why does my SVG show as black or empty?

The most common cause is a # in a colour. Use rgb(46,125,50) instead of #2E7D32, because a hash sign cuts the data URI. Also avoid <line> and <polyline>: Power BI drops them silently. Draw with rect, circle, path and text.

Why does the table column show long text instead of a picture?

The Data category is not set. Select the measure, open Measure tools and set Data category to Image URL.

Why are the images in my table so small?

A table uses one image size for every image column. Select the table, open Format, and set the Image size height and width (24 by 200 in the video).

Does the AI always write the same measure?

No. AI answers change a little from run to run. Keep the rules prompt at the start of every chat, test each measure before you trust it, and send the error text back to the AI if something looks wrong.

Is the practice file free?

Yes. The zip has the Practice and Solution .pbix files, the Summit Coffee data in Excel, the prompt template and the answer key. The figures are example data for learning.

Download the Practice Files

Get the Practice and Solution .pbix files, the data, the prompt template and the answer key in one zip – free.

⬇️  Join Free on Skool & Download the Practice File
Free membership · takes 1 minute · the file is in Classroom → Free Downloads from YouTube
Practice + Solution .pbix · Summit Coffee data · AI prompt template · answer key · .zip · Power BI Desktop

About the Author

PK (Priyendra Kumar) runs PK: An Excel Expert and NextGenTemplates.com and has been teaching Excel, VBA and Power BI on YouTube for years. Every step in this tutorial was recorded in real Power BI Desktop with the files you can download above. The data is example data for learning.

Conclusion

With a few DAX measures that return SVG, the built-in Image and Table visuals turn into KPI cards, progress bars, bullet charts, status pills and donuts, and Claude does the typing. Download the free files, run the five prompts once and reuse the template for your own reports.

PK
Meet PK, the founder of PK-AnExcelExpert.com! With over 15 years of experience in Data Visualization, Excel Automation, and dashboard creation. PK is a Microsoft Certified Professional who has a passion for all things in Excel. PK loves to explore new and innovative ways to use Excel and is always eager to share his knowledge with others. With an eye for detail and a commitment to excellence, PK has become a go-to expert in the world of Excel. Whether you're looking to create stunning visualizations or streamline your workflow with automation, PK has the skills and expertise to help you succeed. Join the many satisfied clients who have benefited from PK's services and see how he can take your Excel skills to the next level!
https://www.pk-anexcelexpert.com