0
0
Power BIbi_tool~10 mins

SWITCH function in Power BI - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

This table lists products and their category codes.

CellValue
A1Product
A2Apple
A3Banana
A4Cherry
B1Category Code
B21
B32
B43
Formula Trace
SWITCH(B2, 1, "Fruit", 2, "Snack", 3, "Dessert", "Unknown")
Step 1: SWITCH(1, 1, "Fruit", 2, "Snack", 3, "Dessert", "Unknown")
Cell Reference Map
    A       B
1 Product  Category Code
2 Apple    -> 1
3 Banana     2
4 Cherry     3
The formula uses the value in cell B2 (Category Code for Apple) to decide the output.
Result
    A       B          C
1 Product  Category Code  Category Name
2 Apple    1          Fruit
3 Banana   2          
4 Cherry   3          
The SWITCH formula in C2 returns "Fruit" because B2 is 1, matching the first case.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does the SWITCH function return when B2 is 1?
A"Fruit"
B"Snack"
C"Dessert"
D"Unknown"
Key Result
SWITCH(expression, value1, result1, value2, result2, ..., default_result)