Picture this: you’re in the Report Builder, building a Revenue by State report. You’re in the zone. Everything is going swimmingly until you go to add a billing state grouping to your report and you see this:
How could this happen?
Unfortunately, a lack of standardization can sometimes lead to messy data and headaches when building reports. In our example, there may not have been a dropdown menu or standardized way for our customers to input their billing state information. This lead to a variety of values - ‘pa,’ ‘PA,’ ‘penna,’ ‘pennsylvania,’ and ‘Pennsylvania’ - all for the same state, which will certainly lead to some strange results in the Report Builder.
It’s possible that there’s a tech resource that can help you clean up the data or insert the columns you need directly into your database, but if not, we have another solution: the mapping table. A mapping table allows you to quickly and easily cleanse and standardize any messy data by ‘mapping’ data to a single output.
** You cannot create a mapping table for consolidated tables without help from our Support team. Reach out us for additional information. **
Before you dive in, we recommend that you export the raw table data. Looking at the raw data first means you can explore all possible combinations for the data you need to clean up, thereby ensuring that the mapping table covers everything.
To make a mapping table, you’ll need to create a two column spreadsheet that follows the formatting rules for file uploads.
In the first column, enter the values stored in your database with only one value in each row. For example, ‘pa’ and ‘PA’ can’t be on the same line - each input needs to have its own row. See below for an example.
In the second column, enter what these values should be. Continuing with our billing state example, if we want ‘pa,’ ‘PA,’ ‘Pennsylvania,’ and ‘pennsylvania’ to simply be ‘PA,’ we’d enter PA in this column for each input value.
After you’ve finished creating the mapping table, you’ll need to upload the file into Magento BI and create a joined column that relocates the new field into the desired table. You can do this after the file is synced to your data warehouse.
In our example, we’ll move the column we created on the mapping_state table (state_input) to the customer_address table using a joined column. This will allow us to group by the clean state_input column in our reports instead of the state column.
To create the joined column, navigate to the table that the field will be relocated to in the Data Warehouse Manager. In our example, this would be the customer_address table.
After an update cycle completes, you’ll be able to use your new joined column to properly segment your data instead of the messy column from your database. Take a look at our grouping options now - no more stress mess:
Mapping tables are handy for any time you want to clean up some potentially messy data in your data warehouse. However, mapping tables can also be used for some other cool use cases, like replicating your Google Analytics channels in Magento BI.