3 easy steps to make a KPI with a unit in Power BI
Power BI is a platform that allows you to connect to various data sources, transform and model your data, and create interactive dashboards and reports. Power BI can help you gain insights from your data and communicate them effectively.
What is a KPI?
A KPI, or a key performance indicator, is a measurable target that shows how well an individual or a business is performing in terms of meeting their goals. KPIs can be financial, such as net profit or revenue, or nonfinancial, such as customer satisfaction or retention. KPIs help organizations track their progress, identify their strengths and weaknesses, and make informed decisions to improve their outcomes.
Building the KPI
We will be making this KPI:
Here first we need to calculate the average of electric range of vehicles and then add unit miles at the end because without a unit it will be a plain value of 67.83 which won’t convey the necessary meaning of KPI.
1.DAX calculation for Avg Electric Range
Avg Range1 = AVERAGE(Electric_Vehicle_Population_Data[Electric Range])
We are simply calculating the Average of Electric Range column of Electric_Vehicle_Population_Data Table.
As you can see, the KPI has no information of the unit of the value 67.83 because the column Electric Range is just a numerical column and we have the task of attaching a categorical unit to a KPI without changing its numerical significance.
2.DAX calculation for Avg Electric Range with a unit
I figured out two ways do it:
DAX for the first way:
Avg Range = CONCATENATE(FORMAT(AVERAGE(Electric_Vehicle_Population_Data[Electric Range]), “0.00”), “miles”)
Now the CONCATENATE requires two strings and then it joins them.
For the first string we have a FORMAT function part which again requires two parts:
- The Value which here is AVERAGE(Electric_Vehicle_Population_Data[Electric Range]).
- Second is Format which here is “0.00” to specify two decimal digits in the KPI.
For the second string we have “miles” to specify the unit of measurement and finally we get the KPI format we were looking for.
DAX for the second way:
Avg Range2 = FORMAT(AVERAGE(Electric_Vehicle_Population_Data[Electric Range]), “0.00miles”)
Here we only use FORMAT function which has two parts:
- The Value which here is AVERAGE(Electric_Vehicle_Population_Data[Electric Range]).
- Second is Format which here is “0.00miles” to specify two decimal digits and the miles string to specify the unit at the end of decimal digits in the KPI.
We discussed two ways : where the first one is bigger but easily adjustable and clearer and the second one is less intuitive but concise, nevertheless both are excellent techniques to achieve our goal.
3.Formatting the KPI
Now get a card visual from Visualizations and put the Average Range or Average Range2 to it.
In Visualizations head to Format your visual then in Visual go to Callout value, expand it choose a colour of your choice(I used Hex code #6FD771), Bold the Font and set size to 28.
Next head to General, expand Title, in Text type Avg Electric Range choose a Font and a Font colour of your choice, set size to 11 and for Horizontal alignment select Center.
Now expand Effects and in Background choose a colour of your choice, I used Hex code #002407.
Finally we have our KPI.
To create a Dynamic Title refer to this link.
To create a KPI with TopN refer to this link.
To create a KPI with an image refer to this link.
To create a Rolling 12 Months KPI refer to this link.
To create a KPI with an indicator refer to this link.
To read more stories like this you can follow me with this link.
References:
Don’t forget to subscribe to
and join our Power BI community