Power BI just keeps getting better. The addition of the KPI visual to the standard palette is just another example in a long line of improvements, and the subject of this quick article.
Key Performance Indicators have been around long before the computer age. Show of hands: Who has ever browsed the new car showroom and NOT looked at the window stickers listing the vehicles’ MPG ratings? I thought not. While maybe not a true KPI as explained by Gerke & Associates, Inc here, Miles per Gallon is something we all understand when talking about the performance metric of a car. Most cars now come with computerized displays that will show instantaneous MPG, or an average over time. Keep these in mind when we transition this discussion over to Power BI.
In SQL Server Analysis Server cubes, you had the ability to create KPI’s inside the cube. They could then be browsed by the tool to which it was connected, something such as an Excel Pivot Table. Thought slightly different, KPI’s were also available in Analysis Server Tabular Models and Excel PowerPivot, both precursors to the Power BI Desktop.
But data analysts and modelers may experience premature disappointment to find that there is no way to create a KPI when using the Power BI Desktop designer. Knowing it was there in Excel PowerPivot models doesn’t help. It was there before, why did they take it out? Enter the KPI VISUAL.
By selecting this visual, you can create a KPI out of any metric in your model. It has three simple fields in the designer to define its appearance: Indicator, Trend axis, and Target goals. Let’s take a look at each of these in turn.
- Indicator: This is the aggregated column or measure being considered. It could be as simple as the Sum of Sales. You do NOT need to slice this metric down to the latest value, such as [Sum of Sales for the last full month] or anything crazy like that. The base metric will suffice. The reason is explained below.
- Trend axis: Grab a date type field for this (obviously) and (not so obviously) select the granularity: year, month, etc. Doing so will tell the KPI visual how you want to aggregate the Indicator metric over time.
At this point, your KPI should display two things: a black number and a grey shaded area in the background. We’ll explain all this at the end.
- Target goal: This can also be an aggregated column or measure similar to the Indicator. If you don’t have one, it’s easy to create a ‘static’ goal by adding a new Measure with a simple static value such as: “KPI Goal = 100”, which is what I did for this demo.
Now, there’s only two options when you get all those things set: either it looks right, or it doesn’t. Consider the following two KPI Visuals from Power BI, both created from the same set of data, both using the same field settings.
The green one on the left I can tell you is how it is supposed to look based on the data I entered. It’s easy to see in the 6 rows that there has been a steady increase over the last 4 years.
So why did my initial attempt at a KPI result in the red one on the right? Apparently there is a dependency on the order in which the KPI is designed. If you selected a metric to add to your canvas first, and then decided to switch it to a KPI, you may get erroneous results. If, however, you start by adding an empty KPI to the canvas and then populating the three fields, you will probably see what you expect. If it doesn’t look right, the fix is quite simple really: remove the Indicator field and re-add it! It may be quirky, but it works.
Now let’s talk about all the pieces of information contained in this one (now correctly formatted) KPI visual. Referring to the green version on the left above, the bold number 120 corresponds to the value calculated (probably summed) for the latest point of the Trend Axis. Based on my data, that is the point for 1/1/1015. Typically, data would be spread over may dates over the years, but the aggregation of the Indicator, and the granularity of the Trend axis will determine the latest point to be displayed. The shaded green area is the trend plot for the Indicator. This shows a decrease at the very beginning, but steady increase after that. Next we see the green check-mark and green shade, indicating that this point is above the goal. (Using the format menu for the KPI you can reverse this if a lower number is better.) Finally, the small black text below the Indicator shows us the Goal, and the distance from that goal.
With this type of control in your hands, you can easily create KPI’s that display the same Indicator, but for different time slices such as by year, quarter, month, week, or day, depending on your needs.
Want to learn about some additional features in Power BI. View our series on Row Level Security in Power BI: