Dashboard Mode - SWITCH function
Dashboard Goal
Understand how sales performance varies by product category and show a clear label for each category using the SWITCH function.
Understand how sales performance varies by product category and show a clear label for each category using the SWITCH function.
| Order ID | Product Category | Sales Amount |
|---|---|---|
| 1001 | Electronics | 250 |
| 1002 | Clothing | 150 |
| 1003 | Electronics | 300 |
| 1004 | Furniture | 450 |
| 1005 | Clothing | 200 |
| 1006 | Furniture | 350 |
| 1007 | Electronics | 400 |
Total Sales = SUM('Sales'[Sales Amount])Category Label = SWITCH('Sales'[Product Category], "Electronics", "Tech Gear", "Clothing", "Apparel", "Furniture", "Home Goods", "Other")Category Label.+----------------------+----------------------+ | Total Sales | Sales by Category | | (KPI Card) | (Bar Chart) | +----------------------+----------------------+ | Sales Details Table | +-------------------------------------------------+
A slicer on Product Category lets you filter all components. Selecting a category updates the KPI card, bar chart, and table to show only that category's data.
If you add a filter for Product Category = Electronics, which components update and what will the Total Sales show?
SWITCH function do in Power BI?SWITCH function in DAX?Category Result = SWITCH( 'Sales'[Category], "A", "High", "B", "Medium", "C", "Low", "Unknown" )
'Sales'[Category] is "B"?Result = SWITCH( TRUE(), Sales[Amount] > 1000, "High", Sales[Amount] > 500, "Medium", Sales[Amount] > 100, "Low" )
SWITCH formula correctly implements this?Pass the test and this pattern moves unknown