Power BI has introduced a game-changer: the new PowerBI KPI Card with references! The PowerBI November update changes how we see and understand data. It’s not just another feature; it’s a big step in data analytics.
Before, we only saw numbers on KPI cards. Now, the new KPI Card shows us a complete picture. It turns simple data into powerful insights.
Traditional vs. New KPI Cards: A Comparative Analysis
The “Normal” KPI Card in Power BI
The standard KPI cards in Power BI were straightforward but limited. They displayed key figures like sales totals or quarterly earnings, providing basic data at a glance. However, these cards lacked context. They showed numbers in isolation, making it difficult to gauge performance over time or against set targets. This lack of comparative data and trend analysis limited their usefulness in strategic decision-making.
Okviz Custom KPI Card
To enhance data visualization, I often turned to Okviz’s custom KPI Cards. These cards aimed to offer more than just standalone figures. They included trend lines beneath the main number, offering a glimpse into performance over time. However, these cards had their challenges. They were complex to set up, often requiring the integration of multiple elements for a complete view. This complexity sometimes led to configuration errors, resulting in inaccurate data displays. Especially when showing averages, you had to separate the trendline and the KPI Value as two visuals to show the correct data!
The image below shows 3 main KPIs. Each KPI needed a minimum of 3 individual visuals to complete the image. This is time consuming and not efficient when aligning and managing visuals.
The New PowerBI KPI Card
The latest update brings the “New Power BI KPI Card with References and Line Chart,” a significant improvement over both previous versions. This new KPI Card boasts several key features:
- Integrated View: It consolidates various data points into a single, comprehensive visual.
- Customization Options: Users can personalize the card with images and format each reference label individually, enhancing the visual appeal and readability.
- Reference Labels: The standout feature is the ability to add reference labels. These labels allow users to compare current data against benchmarks like previous performance, budget targets, or industry standards.
- Flexibility: The new KPI Card offers greater flexibility, allowing users to input multiple reference points for a more detailed analysis. Each KPI can have a different number of reference points!
- User-Friendly Design: It simplifies the visualization process, making it more accessible to users of all skill levels.
Creating a Line Chart in the New PowerBI KPI Card
The new KPI Card doesn’t have a trendline built-in. But you can add one yourself. You use DAX and SVGs to make a line chart. This chart shows trends like sales going up or down. Here’s a step-by-step manual to create a line chart for the new PowerBI KPI Card Visual. The SVG linechart is inspired by Kerry Kolosko, who has a great variety of SVG images on her website. I simply took the Sparkline Chart and modified it using ChatGPT to create the line chart you can see in the image above:
Step 1: Create new measure
You can copy the code below: Simply replace my measures with your measures.
1. dTime[EndOfMOnth] is my date range showing Year/Month data in form of 2023/11.’ Just replace this one with the date field from your PowerBI data model.
2. [Total Costs AC] refers to my total cost this year. Just replace this measure with any given measure that you want to visualize.
Sparkline Total Cost =
// Static line color
VAR LineColour = "black"
VAR PointColour = "white"
VAR Defs = "<defs>
<linearGradient id='grad' x1='0' y1='25' x2='0' y2='50' gradientUnits='userSpaceOnUse'>
<stop stop-color='#666666' offset='0' />
<stop stop-color='#CCCCCC' offset='0.3' />
<stop stop-color='white' offset='1' />
</linearGradient>
</defs>"
// "Date" field used in this example along the X axis
VAR XMinDate = MIN(dTime[EndOfMOnth])
VAR XMaxDate = MAX(dTime[EndOfMOnth])
// Obtain overall min and overall max measure values when evaluated for each date
VAR YMinValue = MINX(Values(dTime[EndOfMOnth]),CALCULATE([Total Costs AC]))
VAR YMaxValue = MAXX(Values(dTime[EndOfMOnth]),CALCULATE([Total Costs AC]))
// Build table of X & Y coordinates and fit to 50 x 150 viewbox
VAR SparklineTable = ADDCOLUMNS(
SUMMARIZE('dTime',dTime[EndOfMOnth]),
"X",INT(150 * DIVIDE(dTime[EndOfMOnth] - XMinDate, XMaxDate - XMinDate)),
"Y",INT(50 * DIVIDE([Total Costs AC] - YMinValue,YMaxValue - YMinValue)))
// Concatenate X & Y coordinates to build the sparkline
VAR Lines = CONCATENATEX(SparklineTable,[X] & "," & 50-[Y]," ", dTime[EndOfMOnth])
// Find the maximum and minimum points
VAR MaxPoint = TOPN(1, SparklineTable, [Y], DESC)
VAR MinPoint = TOPN(1, SparklineTable, [Y], ASC)
// Extract X and Y values for max and min points
VAR MaxPointX = MAXX(MaxPoint, [X])
VAR MaxPointY = MAXX(MaxPoint, [Y])
VAR MinPointX = MAXX(MinPoint, [X])
VAR MinPointY = MAXX(MinPoint, [Y])
// Last data points on the line
VAR LastSparkYValue = MAXX( FILTER(SparklineTable, dTime[EndOfMOnth]= XMaxDate), [Y])
VAR LastSparkXValue = MAXX( FILTER(SparklineTable, dTime[EndOfMOnth] = XMaxDate), [X])
// Add to SVG, and verify Data Category is set to Image URL for this measure
VAR SVGImageURL =
"data:image/svg+xml;utf8," &
--- gradient---
"<svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' viewBox='-7 -7 164 64'>" & Defs &
"<polyline fill='url(#grad)' fill-opacity='0.3' stroke='transparent'
stroke-width='0' points=' 0 50 " & Lines &
" 150 150 Z '/>" &
--- Lines---
"<polyline
fill='transparent' stroke='" & LineColour & "'
stroke-linecap='round' stroke-linejoin='round'
stroke-width='1' points=' " & Lines &
" '/>" &
--- Max Point---
"<circle cx='"& MaxPointX & "' cy='" & 50 - MaxPointY & "' r='2' stroke='green' stroke-width='3' fill='green' />" &
--- Min Point---
"<circle cx='"& MinPointX & "' cy='" & 50 - MinPointY & "' r='2' stroke='red' stroke-width='3' fill='red' />" &
--- Last Point---
"<circle cx='"& LastSparkXValue & "' cy='" & 50 - LastSparkYValue & "' r='3' stroke='" & LineColour & "' stroke-width='2' fill='" & PointColour & "' />" &
"</svg>"
RETURN SVGImageURL
2. Save the measure as Image URL
Click on the measure and on the top menu under “Measure tools” go to Data Category and select Image URL
3. Include the Image URL in the New PowerBI KPI Card:
Click on the new KPI Card, navigate to the visualization pane and open the image label.
Select the relevant KPI (in my case “Total Costs AC”) and under image select “Image URL”.
Then click on the formula Icon and choose the newly created measure.
Its important to check the image size after referring to your measure. I set the size in my case to 200
There are many settings to customize the color and layout of the new KPI card in PowerBI. For now, this blog post focuses on showing how to integrate the line chart into the KPI Card itself. In the settings above you can also choose the position. Personally, I like the position on the bottom below the main KPI number.
The Missing Piece: Tooltips in the New KPI Card
Despite the impressive advancements of the new KPI Card, one notable feature is still missing: tooltips. In the custom KPI card by Okviz, hovering over elements would reveal detailed insights, such as monthly data breakdowns. This functionality added a layer of depth, allowing users to quickly access specific data points without cluttering the visual field.
The absence of this feature in the new KPI Card means users can’t immediately view detailed information, such as month-by-month comparisons, by simply hovering over the visual. This limits the ability to quickly glean detailed insights at a glance. It’s a minor setback, but it’s significant for users who rely on this level of interaction for deeper data analysis.
Conclusion: A New Era in Power BI Visualization
In conclusion, the New Power BI KPI Card with References and Line Chart represents a notable advancement in the realm of data visualization within Power BI. It successfully integrates key features like an all-in-one visual, extensive customization, and the invaluable addition of reference labels, making data more contextual and insightful. While there’s room for improvement, particularly in the area of interactive tooltips, the new KPI Card is undeniably a step in the right direction.
It simplifies complex data presentations and makes them more accessible and meaningful. As the tool continues to evolve, we can anticipate further enhancements that will refine and perfect its capabilities, offering even more powerful tools for data analysts and decision-makers.