In Tableau forum, Danny Lee asked a question: How to blend two data sources, Salesforce and Amazon RedShift by country? The blending request sounds reasonable. What's problem?
The problem is that the countries are in different notations: One is in short format, and the other is in long format.
Say, one is like this:
Country_Short
US
UK
CN
FR
The other is like:
Country
United States of America
United Kingdom
France
People's Republic of China
How to blend them? Are they blendable at all? The answer is affirmative, not without a little twist though. I am listing two ways of doing it. Assume both data sources are connected.
1. Create a calculated field [Country] based on [Country_Short]:
Using this newly created dimension [Country], you can blend with the other data source.
2. Add an alias to each country in the [Country] list of the second source.
- open a fresh worksheet
- drag [Country] to the row shelf
- right click on each country and click the last item of the context menu which is Edit Alias
- edit the alias of 'United States of America' to be US and so on
- make sure all the aliases are the corresponding names in the other table.
Either of the above lays the ground for blending the two data sources. We are ready to blend.
To blend naturally, rename the two country dimensions to be exactly the same. Tableau will try to link up the two dimensions automatically through intelligent guess.
If you want to keep the dimension names different and still want to blend the two tables,
- open menu Data>Edit Relationships
- link up the two dimensions there, using custom method to join the two data sources.
Note that for some data sources such as published data extracts, you are not allowed to edit aliases. Quite a weird restriction. The workaround is to duplicate the dimension in question, and work on the duplicate.
You may also right-click any dimension to edit the aliases for the whole filed.
In Tableau Desktop 8: Right-click Dimension>Default Properties>Aliases...
In Tableau Desktop 9: Right-click Dimension>Aliases...
The end.
No comments:
Post a Comment