# The IN operator

> This is content from just-tim, the data-and-analytics channel by Tim Ngwena (formerly 'Tableau Tim'). Tim has 12+ years of hands-on BI experience and covers Tableau most of all, plus Power BI, Looker, Hex, SQL and data modelling, the analytics industry, and the craft of doing the job — always tool-agnostic and honest about the trade-offs.

- **Author:** Tim Ngwena (just-tim, https://just-tim.com/about)
- **Published:** 2020-08-12
- **Format:** Video · 11 min watch · transcript available
- **Topics:** Data visualisation
- **Tools:** Tableau (calculated fields, dashboards, in operator, sets)
- **Canonical:** https://just-tim.com/posts/the-in-operator-tableau-2020-3
- **Watch:** https://www.youtu.be/nIrahwJTpPM

I introduce the new IN operator added in Tableau 2020.3, showing how it simplifies long calculations that previously relied on repeated OR statements. I also demonstrate how the IN operator works with sets and set actions to let users dynamically control what's being checked on a dashboard.

## Key takeaways

- The IN operator lets you replace long OR-based calculations with simpler, more maintainable syntax by checking a value against a bracketed list of expressions
- You can use a double forward slash to comment out lines within a Tableau calculation
- Changing a calculation's data type to true/false may require removing and re-adding the field on a shelf to refresh it
- The IN operator can check a value against a set, not just a list of literals
- Combining IN with set actions lets dashboard users dynamically build their own selection list, with parameters usable on either side

## Chapters

- 0:00 Introducing the IN operator
- 0:44 Building a sample chart
- 1:33 Writing the old OR-style calculation
- 2:57 Simplifying it with the IN operator
- 4:47 Using IN with a set
- 5:49 Building a dynamic dashboard with set actions

Watch the full video, read the transcript and use chapter deep-links on the page: https://just-tim.com/posts/the-in-operator-tableau-2020-3

---
just-tim — Data and analytics, with a point of view. · https://www.youtube.com/channel/UC7HYxRWmaNlJux-X7rNLZyw · https://twitter.com/TableauTim · https://www.linkedin.com/in/timngwena
