Key performance indicators, or KPIs, are metrics that indicate how well an organization is performing against its objectives. KPIs are typically represented as easily understandable color-coded symbols in a dashboard. For example, a red circle could mean that area is not meeting objectives, while a green circle does.
In this recipe, we will show the top 10 New York restaurant cuisines based on their average inspection scores from 2012-2016 in a text table with KPIs.
To follow this recipe, open B05527_02 – STARTER.twbx
. Use the worksheet called KPI Text Table
, and connect to the DOHMH New York City Restaurant
data source.
The following are the steps to create a KPI table:
In this recipe, we have chosen to display a symbol beside each value in our text table. In many ways this is really just a text table, which is covered in Creating a text table recipe in Chapter 1, Basic Charts. How this is different is based on how the text for each cell is created.
We first need to create calculated fields that will determine the grades for the cuisines. According to the Government of New York website, for each inspection:
If you are interested in how New York restaurants are graded, you can read the official guide from http://www1.nyc.gov/assets/doh/downloads/pdf/rii/how-we-score-grade.pdf.
We are just going to use the same criteria for the average scores for each cuisine. Each of these calculations is an If
statement. If the value falls within a certain range, the If
statement returns a special character:
The characters are copied from http://www.copypastecharacter.com/alphabetical-order.
Once the score fields are created, the text field needs to be created. In this text field, all the previous calculated fields are included—each grade is formatted with a different color.
Each of the grades are mutually exclusive. Since the individual grade calculated fields just IF statements and not If...Else
statements, if the scores are outside of a specific range, there is nothing that gets displayed. This creates the dynamic label effect.
Instead of multiple calculated fields, you can also choose to just have a single calculated field. In this case, having multiple calculated fields may be helpful especially if you want to reuse these in tooltips and so on.
Another way, and perhaps more common, is to use the shapes to create a KPI table. We will still need a calculated field that will give us the discrete values for the average grade.
This field can be used in a Shape property in the Marks card to display common KPI icons.
52.15.78.83