How to rename a field name or field values?
Some things that happen commonly are that you want to rename a field or rename the field values; so that they can be displayed as end-user friendly results.
In this guide, I will walk you through the approaches to do that.
Case #1: Rename or change a field name
You could customize field labels to affect how field names appear in the Reporting tab; the change does not affect the database itself.
For example, you want to display label of legends as A
, B
, C
instead of 'A Running Total', 'B Running Total' and 'C Running Total’.
There are two ways to change them:
Approach #1.1: Edit field labels when data modelling
You can edit a model field and change its default field label in the reports.
Approach #1.2: Select Custom Label
when editing a report
You can mouse over a field and click on it to reveal the drop-down menu and select ‘Custom Label’ to change the field label for that specific report.
Note: For customizing label of the measure which is created by using an aggregate function in the UI, we can only use approach #1.2
Case #2: Rename or label values within a field
For example, I want to change the gender labels below to something friendlier such as Female or Male
Approach #2.1: Create a custom dimension in the data modelling layer
You could create a custom dimension and use CASE...WHEN
operator to change how the values are displayed.
Note: When applying this approach, we recommend hiding the original field so that users don’t select the field that is not renamed.
Approach #2.2: Use business calculation in reporting tab
Add a business calculation in the report and use the case when
operator to rename the data labels only for the current reports.
For the cases that the fields have list of many values which is not human friendly to display in reports, our recommendation is:
- Create and import a mapping table with values of the mapping (old field values, display values)
- Define the relationship that joins this mapping table with original table (1-n) to get the display value.
Pros/Cons
- If you change the field label or field values when data modelling, the result is more reusable that can be selected across all reports. However, this can only be done by users who have access to Data Modeling Layer
- In case you want to customize them when editing the report, the result is only for that specific report. Nevertheless, any users with Explorer Role can do that.