Subject Area: Design
Level of complexity: Intermediate
Approximate Time to complete: 1 hour
Companion Workbook (twbx): n/a
Additional Resources on the web:
Boolean, or True/False, calculations are pretty simple. These calculations are evaluating whether the statement being made is true or false. As a basic example, does 2=2? True!
As you can see, these are not complicated to figure out so databases can run these queries very efficiently. This is why many of our customers are utilizing "Boolean" (True/False) calculations in Tableau because they are great for performance. Boolean calculations are a highly recommended filtering method when using large datasets.
Many times a beginner in Tableau desktop will create their own True/False calculation by using an "if statement" like this:
This is not recommended. When working with large datasets, this calculation can become an added factor in performance because we are adding a long column of text to the dataset. We can write a much more efficient calculation that is automatically True/False for us:
Now Tableau can much more quickly and efficiently filter out values that are less than 10,000 instead of assigning it a full string value of "True" or "False".
Boolean calculations are also a great way to incorporate parameters into a worksheet. For example, if a customer wants to use a parameter to filter on year they can set the year of the Date field equal to the parameter
...and then place that on the filter shelf: