In the previous recipes, we have looked at different calculations such as string, arithmetic, and date calculations. In this section, we will focus on the Logic statements. These are typically IF….ELSE statements or CASE statements.
Imagine having to conditionally format your data to highlight products having actual sales less than the target value. In order to address this requirement, we need to make use of Logic statements. These logic statements will execute a certain expression once a condition is met or else it will execute another expression.
Let's get started with Logic statements in Tableau.
Let's take an example where we will try to conditionally color code/highlight the product Sub-Categories that are having Sales less than 100K. We will use the fields from the Orders sheet of Sample - Superstore.xlsx
data and as usual, continue working in our existing workbook. Let's see how we can achieve the previously stated objective.