3 easy steps to make a KPI with a unit in Power BI

Shashanka Shekhar
Microsoft Power BI
Published in
4 min readFeb 8, 2024

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.

A snapshot of Electric Vehicles Dashboard in Power BI

Building the KPI

We will be making this KPI:

Avg Electric Range KPI with miles as unit

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])

DAX for Average Electric Range Calculation

We are simply calculating the Average of Electric Range column of Electric_Vehicle_Population_Data Table.

Resultant KPI

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”)

DAX for Avg Range calculation

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:

  1. The Value which here is AVERAGE(Electric_Vehicle_Population_Data[Electric Range]).
  2. 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”)

DAX for Avg Range calculation

Here we only use FORMAT function which has two parts:

  1. The Value which here is AVERAGE(Electric_Vehicle_Population_Data[Electric Range]).
  2. 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.

Callout value settings

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.

Title settings

Now expand Effects and in Background choose a colour of your choice, I used Hex code #002407.

Background settings

Finally we have our KPI.

The Final 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:

  1. https://www.investopedia.com/terms/k/kpi.asp
  2. https://www.forbes.com/advisor/business/what-is-a-kpi-definition-examples/
  3. https://en.wikipedia.org/wiki/Performance_indicator

Don’t forget to subscribe to

👉 Power BI Publication

👉 Power BI Newsletter

and join our Power BI community

👉 Power BI Masterclass

--

--

Shashanka Shekhar
Microsoft Power BI

Contributor for Microsoft Power BI. I like Data Analysis and Data Science. Also I enjoy sports, videogames and Japanese Anime in my free time.