Hi Alex, You can use case statement in Tableau calculated field.
Due to the country overlapping scenario, I think you have to create 4 calculated fields to make your custom groupings in Tableau.
Case [Country] When 'US' Then 'United States'
Sample workbook attached.
Custom Group.twbx.zip 17.3 KB
Hi, thanks for the prompt feedback.
I need to have just one calculated field because I will use it in the page by so that the end user can select the different groups.
Sent from my iPhone
I have been working more on this - I am trying to avoid having a geo group(Region). and just have groupings
Ideally I would like groupings for US, AU, CA,UK,SWE, America, Wordwide, Other Countries
When I try to create a parameter for this groupings and create a calculated field with a case statement I get duplicates?
Any ideas on how to just have groups defined as US, AU, CA,UK,SWE, America, Wordwide, Other Countries
Can you share your calculation or sample packaged workbook?
What you are asking for here is very difficult. Essentially, by having all of these groups in the view, you are asking Tableau to duplicate records. For example, you are asking for Canada to show up by itself, within the America group, and within the Worldwide group.
The best way to accomplish this within editing your underlying data is to use multiple calculations and create a hierarchy so that your users can still select and drill up and down within the hierarchy.
I hope this helps,
Hey I figured it out,
I edited the case statement and it worked perfectly for groups that need to be shown individually and also overlap. e,g US and America which includes US and CA. The 'end' after each 'when' statement avoids exclusion.
case [Choose grouping]
when 'America' then
if [Dim_Country_Description] = 'US' or [Dim_Country_Description] = 'CA'
when 'United States' then
if [Dim_Country_Description] = 'US'
then 'United States'
I then linked this custom group to a parameter with America and United States as values and selected to show the parameter
I added the calculated filed to the filter and typed United States and and America in the custom value list.
Thanks for your ideas folks