
This article explores how to enhance Power BI sales reports with colorful, animated SVG progress bars and donut KPIs using simple DAX measures. It covers creating target versus actual comparisons with color-coded visuals, animation effects, and responsive slicers, all without paid visuals. The guide explains the DAX logic, SVG customization, and best practices for integrating these visuals into Power BI dashboards.
Imagine transforming your sales report into a visually engaging dashboard featuring color-coded progress bars, donut KPIs, and even animated elements that dynamically compare target versus actual sales figures. All of this can be achieved using SVG (Scalable Vector Graphics) combined with simple DAX measures in Power BI—without relying on any paid visuals.
This article is a continuation of a previous tutorial where we introduced SVG basics and built a simple status pill. Here, we dive deeper into creating more sophisticated and visually appealing SVG bars and gauges.
Before we begin, ensure you have the following:
We will use a sales dataset where each sales representative has a target and actual sales number. Our goal is to compare these two values and visualize the attainment percentage (actual divided by target) using SVG visuals.
The color coding logic is straightforward:
The first visual is a simple progress bar that reflects the percentage of the target achieved. It displays the bar filled proportionally to the attainment percentage and colors it based on the criteria above.
The DAX measure calculates the attainment percentage by dividing actual sales by target sales. It then applies conditional logic to assign the appropriate color.
The SVG code defines the size and position of the bar and includes a text element to display the percentage value on top of the bar.
To add animation, we modify the SVG to include animation attributes such as duration and repeat count. For example, setting the animation duration to 8 seconds and repeat to infinite creates a continuously animating progress bar.
This animation can be a blinking effect or a flowing effect where the bar appears to move from left to right continuously.
Another variation divides the progress bar into multiple small rectangles (boxes). These boxes fill sequentially from left to right based on the attainment percentage, creating a visually distinct animation.
Donut charts are another effective way to visualize attainment percentages.
A simple donut chart shows the percentage achieved with color coding similar to the progress bars. The percentage is displayed in the center of the donut.
Animation can be added to the donut chart to create a flowing effect, such as a continuous fill from top to bottom.
Instead of a continuous arc, the donut can be composed of dots that fill based on the attainment percentage, adding a unique visual style.
The core DAX logic involves:
Actual / Target.Example snippet for color logic:
Color = SWITCH(
TRUE(),
Percentage >= 1, "green",
Percentage >= 0.85, "amber",
"red"
)
The SVG string is built by concatenating SVG elements with dynamic values for width, color, and animation parameters.
By combining SVG with DAX measures, you can create stunning, interactive, and animated progress bars and donut KPIs in Power BI. These visuals not only improve the aesthetics of your reports but also make it easier to interpret key performance indicators such as sales attainment against targets.
All the examples and datasets used in this tutorial are available for download and customization to suit your specific project needs.
Thank you for reading, and stay tuned for more advanced Power BI visualization techniques!
Paste a YouTube link and let Magica create the key takeaways.
Summarize another video