Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

In Tableau, I have 20 values that I would like to filter in a calculation instead of dragging into filters. This metric will join other metrics in a table that don't have the same filters. It's too many items and I would like to do it in the best and most practical way without typing them in the formula.

So I created a set Dim_Set

Then wanted to do something like :

{EXCLUDE [Dim_Set]: SUM([Calls])}

Items to exclude are more than 20 items and don't wanna do this and hoping for a better way.

If Startswith([typeDescription], "class")=TRUE then "Keep"

Elseif Contains([TypeDescription], "YAIP")=TRUE then "Exclude"

Elseif Contains([TypeDescription], "Lifeskills")=TRUE then "Exclude"

Elseif Contains([TypeDescription], "WorkReadiness")=TRUE then "Exclude"

Elseif Contains([TypeDescription], "Roster")=TRUE then "Exclude"

Elseif Contains([TypeDescription], "Arrival")=TRUE then "Exclude"

Elseif Contains([TypeDescription], "Arches")=TRUE then "Exclude"

Elseif Contains([TypeDescription], "etc...")=TRUE then "Exclude"

Else "Keep" 

End 

Could you please help? 

1 Answer

0 votes
by (47.2k points)
  • You are doing correct, Follow these steps:

Right-click on the [TypeDimension] field > Create Set...

  • Use the 'Exclude' check mark to select values that you'd like to exclude from the set/dimension like so:

enter image description here

  • From there, a simple calculation can be written:

IF [Dim_Set] THEN [TypeDescription] END

  • This will evaluate each member of your dimension against the set to ensure that it is present - and not 'excluded' - if so, then it will display the [TypeDescription] value.

  • Consider that sets can be treated as booleans within calculated fields.

  • With this method, you will need to then filter out NULL values on the calculated field above. The calculation can be updated accordingly to match your style here. (ie: ELSE "Exclude")

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...