1 of 1 people found this helpful
A set is a convenient way of defining a group of items you are interested in based on criteria. You can achieve the same through a (complicated) if statement.
However not every IF statement can be modeled through a set.
Why do you ask?
There is an interesting blog about set actions to show the power of sets in case you are interested: 8 ways to bring powerful new comparisons to viz audiences with Tableau set actions | Tableau Software
SET divides your items into in and out and you can use either in views. If else is Standard this or that.
Thank you for showing interest on my query.
I come across a dashboard where I need to display customer in and out of 120 days . I used if else and display in color palette . Now I browsed and I found same concept also implemented by set .So I got confused and I posted the above query .
I am searching an example which can show if else can perform but set can not or vice versa.
The big difference between a SET and the IF statement is that a set contains one or more items that - as Deepak already described - are IN or OUT. You can then use the SET to do interesting things, as you can see in the blog post I shared earlier. More information on sets you can also find here: what is major different between set and group and one example and cascading filter and with one example.
An IF statement is much more versitile and can be used for many things. It is just a condition.
You can also mix and match and use a SET in an IF statement. For example IF [SET1] THEN 1 END will return a '1' for each value in the set.
Some benefits of sets:
- With set actions, the consumer of your workbook can change the values in the set
- A set can contain multiple items, while an if statement is bound to a single value