Sort products into bands with SWITCH(TRUE())

Replace a tangle of nested IFs with SWITCH(TRUE(), …) to label every product A, B or C by how much it sells.

You will learn to

  • Test several conditions in order with SWITCH(TRUE(), …)
  • Order the tests from the strictest to the loosest
  • Give a fallback result for everything else

How it works

IF gives you two outcomes. For three or more, `SWITCH(TRUE(), …)` is much easier to read than IFs nested inside IFs.

It takes pairs of **condition, result**, and returns the result of the **first** condition that is true. A final value on its own is the fallback when nothing matched:

`SWITCH(TRUE(), test 1, result 1, test 2, result 2, otherwise)`

Order matters. Put the strictest test first: a product that sold $60,000 also passes “at least $10,000”, so if that test came first it would stop there and get the wrong label.

Practice it hands-on with a real data model and a live report that updates as you type.

Order Size = SWITCH(TRUE(), SUM(Sales[Quantity]) >= 200, "Large", SUM(Sales[Quantity]) >= 100, "Medium", "Small")