Creating conditional calculations
One of the most powerful calculations you can do is conditional calculations. Conditional calculations return a value based on the criteria you set in the calculation itself. When the conditions are met, a certain value is returned, as specified by you in the calculation. Because conditional statements are relatively resource-intensive on your computer's hardware, it is best to perform them during data preparation in Tableau Prep rather than a downstream analysis tool. By performing resource-intensive tasks in Tableau Prep, the data output will already contain the end result, preventing your analysis tools, such as Tableau Desktop, from having to perform these tasks at a less convenient time. In this recipe, we'll calculate the sales tax amount as well. However, this time, we're going to apply a different tax rate based on the department. To do so, we're going to use a conditional calculation.
Getting ready
To follow along...