How to use... Data Roles
In Week 2 of Preppin' Data we set a challenge about grouping City Names together. Let's face it, 'Group and Replace' in Tableau Prep is pretty incredible with the rich, easy-to-use options that are built in to the tool.
Well the Tableau Devs have gone one step further than we even hoped and have added an extra level of validation to our data cleaning: Data Roles.
For String data fields, you now have the ability to set a specific Data Role for Prep to test the data against. Geographic Role, Email Address and URLs can be tested to see if they are valid against Tableau's own list.
With this highlighting you can easily work through the problems using the fantastic 'Group and Replace' functionality shown in the first image.
But what if you want to get rid of those errors? Well by having an active Data Role, you actually get a few more options to play with:
You can either select whether you want to see:
If you haven't had a chance to explore these then I recommend attempting Preppin' Data Week 2 as you get to use these techniques on the 'City' field. Do this before continuing to read this article as it will save a few 'Spoilers'!
_________________________________________________________________________________
For String data fields, you now have the ability to set a specific Data Role for Prep to test the data against. Geographic Role, Email Address and URLs can be tested to see if they are valid against Tableau's own list.
How to use Data Roles:
Where you click on the Data Type icon to change the Data Type, you will find a list of the bottom of selections with all the options (I expect Tableau to add more over time).Why is this useful?
Well by selecting City to compare my list of city names from our Week 2 exercise, you can see what Prep recognises as a true city name and what isn't.With this highlighting you can easily work through the problems using the fantastic 'Group and Replace' functionality shown in the first image.
But what if you want to get rid of those errors? Well by having an active Data Role, you actually get a few more options to play with:
You can either select whether you want to see:
- 'All' - will show the results that meet the Data Role and those that don't (with an '!' next to it)
- 'Valid' - will only show the results that meet the Data Role
- 'Not Valid' - will only show the results that don't meet the Data Role (so you can start cleaning them without being distracted by the valid results).
You can also group by the Data Role Members but I haven't found a use case where this has helped my data preparation yet. Maybe that will be a future Preppin' Data challenge.