0
votes

I have a report that contains 50 sites, but I'm trying to create a calculated field to filter 10 sites only, and show that 10 sites in the parameter selection.

I know in SQL I can use WHERE SITE IN ('Site1','Site2','Site3') , but I'm not sure how to create a calculated field in Tableau.

3

3 Answers

0
votes

You have options of limiting selected sites. One option is to create a calculated field based on the existence of one of the 10 you are looking at being eligible:

CalcField "GoodSite":

CASE [Site]
WHEN 'Site1' THEN 'Good'
WHEN 'Site2' THEN 'Good'
WHEN 'Site3' THEN 'Good'
WHEN 'Site4' THEN 'Good'
WHEN 'Site5' THEN 'Good'
WHEN 'Site6' THEN 'Good'
WHEN 'Site7' THEN 'Good'
WHEN 'Site8' THEN 'Good'
WHEN 'Site9' THEN 'Good'
WHEN 'Site10' THEN 'Good'
ELSE 'Bad'
END

Then you put GoodSite on the filter shelf and select only 'Good'.

Another option is to create a set and use that as a filter using the method discussed at Creating a Filter Using Sets

0
votes

You can simply drag the SITE field to the filter shelf and choose the sites you wish to include in your analysis. It's that easy.

If you want to save that selection of sites to use in other contexts, you can create a set or calculated field as myers_co describes. But that's not necessary just to filter a few worsheet views.

0
votes

Tableau has finally heard you. IN statement has now been included in Tableau desktop's latest version.