Power BI Blog: Renaming Fields in a Custom Hierarchy
27 August 2020
Welcome back to this week’s edition of the Power BI blog series. This week, Jonathan Liau looks at how to rename fields in a custom hierarchy.
For this week’s example we will be looking at a Donut chart visualisation:
The Donut chart currently breaks down total sales data by two product categories, Accessories and Clothing. Imagine that we want to be able to drill down within this chart to see the Total Sales by subcategory. Let’s put that into the legend to see what it would look like:
We want to change the legend name from ‘Subcategory Name’ to Subcategory. We can do that by clicking on the down arrow of the ‘Subcategory Name’ field in the legend area and selecting Rename.
From there, we can change the name to Subcategory. We do not have to change the name of the field in the data table. This enables us to give custom names to each field in each visualisation.
If we want the ability to drill up and down between product categories and subcategories, we are going to have to use a custom hierarchy and use it as our legend.
We create the custom hierarchy by dragging the ‘Subcategory Name’ field over the ‘Product Category’ field.
If we place the custom hierarchy in the Legend area, this is what our Donut chart will look like:
We have the same problem again where we want to change ‘Subcategory Name’ and ‘Product Category’ to Subcategory and Product, respectively. To our dismay, if there is no option to change the names of these two fields in the Legend area.
Thanks for leading us down this rabbit hole for nothing, Jonathan, because we need to change the field name in the table after all… Maybe, maybe not. If we look over to where the custom hierarchy is located on the fields list, we can right click on the ‘Subcategory Name’ field.
Doing so will bring up the following dialog box:
Here we can elect to rename the field.
The Donut visualisation’s legend will update to read Product and Subcategory depending on which level we are drilling down to.