Look up a label with SWITCH and SELECTEDVALUE
Show each region’s manager name in a matrix by matching the selected region with SWITCH, with a fallback for the total row.
You will learn to
- Match one value against a list of exact values with SWITCH
- Give SWITCH a fallback result
- Predict which filters change SELECTEDVALUE
How it works
`SWITCH` has two forms. `SWITCH(TRUE(), …)` tests conditions, for bands like “at least $10,000”. The plain form compares **one value** with a list of exact matches:
`SWITCH(value, match 1, result 1, match 2, result 2, …, otherwise)`
That is perfect for a small lookup, like mapping codes to names, without adding a column to the model. Written as nested IFs, four regions would need four IFs inside each other.
Feed it `SELECTEDVALUE(column)` so it reads the value in the current row. Where several values are visible, such as the total row, SELECTEDVALUE returns blank, nothing matches, and SWITCH returns the final **otherwise** value. Leave that out and those cells are simply blank.
Practice it hands-on with a real data model and a live report that updates as you type.
Category Code = SWITCH(SELECTEDVALUE(Product[Category]), "Bikes", "BK", "Accessories", "AC", "Clothing", "CL", "Mixed")