đ¨ Building Custom SVG Tooltips in Power BI Cards
đ What Youâll Learn
In this tutorial, youâll learn how to take your Power BI visuals to the next level using SVG (Scalable Vector Graphics) inside a Card visual.
Weâll build a dynamic âRegional Tooltipâ that displays Sales, Profit, and Margin metrics with color, dividers, and rounded corners â all driven by DAX!
đĄ Why use SVG in Power BI?
Power BI visuals donât natively support multi-line formatting or layout styling in text-based visuals like the New Card visual.
SVG is a game-changer because it allows you to:
Add colors, shapes, icons, and layout control
Format text precisely where you want it
Create dynamic, data-driven visuals without custom visuals or images
Keep everything in one DAX measure
đ§ą Step-by-Step Guide
1ď¸âŁ Create the base DAX measure
Start with a text-based tooltip to confirm your values:
If you try to show this in the new Card visual, youâll notice â no line breaks đŹ
You canât use any justification, like left justified.
Thatâs where SVG comes in.
2ď¸âŁ Switch to an SVG measure
Use the SVG syntax directly in DAX. SVG works by drawing elements (like text or shapes) at exact positions. Each piece of data is placed with an x/y coordinate.
3ď¸âŁ Add dynamic logic for region selection
We want:
If one region is selected â show âRegionName Region Detailsâ
If no region selected â show âAll Regionsâ with total metrics.
VAR IsOneRegion = HASONEVALUE(Customers[Region])
VAR RegionLabel = IF(IsOneRegion, SELECTEDVALUE(Customers[Region]) & â Region Detailsâ, âAll Regionsâ)
4ď¸âŁ Combine layout and data
We use standard SVG tags:
<rect>
â for background and rounded corners<text>
â for labels and numbers<line>
â for the dividerfill
,stroke
, andfont-weight
for styling
5ď¸âŁ Display in Power BI
To show this visual:
Add the HTML Content visual (or Table / Matrix if you want multiple rows).
In the Values section, choose your new
Regional Tooltip SVG
measure.Under Data category, set it to Image URL.
â Power BI now renders your SVG as a clean, data-driven mini card!
⨠Result
Your new tooltip now features:
A blue header with the selected region name
A light gray divider for separation
Cleanly formatted metrics (Sales, Profit, Margin)
A rounded background box for modern polish
When no region is selected, it gracefully switches to show All Regions totals. đ
đ§ Customization Ideas
You can easily enhance this:
Add icons with
<circle>
or<path>
Change background colors dynamically by performance
Use DAX measures to drive conditional colors (e.g., red margin if below 10%)
Dynamically color the background by margin performance
Add icons using
<circle>
or<path>
Insert sparkline trends with
<polyline>
Use team or product color themes
The possibilities are endless once you start using SVG in Power BI.
đŹ Wrap-Up
This approach merges DAX logic + SVG styling to unlock creative storytelling right inside Power BI â no external visuals, no coding outside the platform.
SVG opens the door for:
Branded cards
Visual tooltips
Data-driven infographics
At DataAxe, we help teams build these kinds of smart, storytelling visuals to make data pop with purpose.
đ Call to Action
If youâd like to:
Learn how to create advanced visuals like this one
Or get a customized Power BI template for your team
đ Visit www.dataaxe.net/en-us
đŠ Or connect with me on LinkedIn to join my Power BI newsletter!