21. Dynamic Charts: Field Parameters, What-if and Dynamic Top N
21.3 The Older Method: Disconnected Table + SWITCH
Start with a problem
Shahrukh opens an old report built before field parameters existed. It uses a table of metric names and a SWITCH measure.
Explain simply
The older method: a disconnected table (no relationships) holds metric names; a SWITCH measure reads the slicer choice and returns the matching measure.
Show the data
| Metric (disconnected table) | Order |
|---|---|
| Sales | 1 |
| Orders | 2 |
About this data: This table uses columns: Metric (disconnected table), Order. This table uses columns: Slicer, Pune, Nashik, Kolhapur. This table uses columns: Field parameters, Disconnected table + SWITCH. This table uses columns: Wrong result, Reason, Correction. Values shown are the lesson examples already on this page (not a new dataset).
Fictional sample data. Practice file: visuals_orders_apr_may_2026.csv (source: src/practice/).
Demonstrate
- Home › Enter data › table
Metric Listwith Metric = Sales, Orders. - Create
Selected Metric = SWITCH(SELECTEDVALUE('Metric List'[Metric]), "Sales", [Total Sales], "Orders", [Total Orders], [Total Sales]). - Slicer on
Metric List[Metric]; bar chart City ×Selected Metric. - Choose Orders.
Show the result
Your result should look like this (fictional sample):
| Slicer | Pune | Nashik | Kolhapur |
|---|---|---|---|
| Sales | 850 | 800 | 450 |
| Orders | 3 | 3 | 2 |
Explain what happened
The slicer filters only the disconnected table; SELECTEDVALUE reads it and SWITCH picks the measure.
Explore further
- Format strings do not change automatically – a field parameter handles that better.
Detailed reference for this lesson:
Before field parameters, developers used a table that is not related to anything, plus a SWITCH measure. It is still useful when you need custom logic per option.
Steps in Power BI
- Home › Enter data › table Metric List with columns Metric (Sales, Orders, AOV, Avg Delivery) and Sort (1–4) › Load. Do not create relationships.
- Select Metric › Column tools › Sort by column › Sort.
- Create the measure below and add a slicer on
'Metric List'[Metric](single select). - Use
[Selected Metric Value]on the chart's Y-axis and[Selected Metric Title]as the dynamic title (fx).
Selected Metric Value =
SWITCH(
SELECTEDVALUE('Metric List'[Metric], "Sales"),
"Sales", [Total Sales],
"Orders", [Total Orders],
"AOV", [AOV],
"Avg Delivery", [Avg Delivery Time (mins)]
)
Selected Metric Title = SELECTEDVALUE('Metric List'[Metric], "Sales") & " by City"
| Field parameters | Disconnected table + SWITCH | |
|---|---|---|
| Setup | Dialog, no DAX needed | Table + measure |
| Switch dimensions | Yes | Hard (needs extra tricks) |
| Formatting | Each measure keeps its own format | One measure = one format (use a dynamic format string to fix) |
| Custom logic per option | Limited | Full control (e.g. different filters per option) |
Ravindra Bagale's Tip
Friends, many students add a new option to the disconnected table and forget to add it to the SWITCH measure, so it shows blank. Keep the table and the SWITCH in sync, and give SWITCH a sensible default value for "no selection". Clear?
Ravindra Bagale's Tip – मराठी
मित्रांनो, बरेच students disconnected table मध्ये नवा option जोडतात आणि तो SWITCH measure मध्ये जोडायला विसरतात, त्यामुळे तो blank दिसतो. Table आणि SWITCH नेहमी जुळलेले ठेवा, आणि "no selection" साठी SWITCH ला योग्य default value द्या. समजलं का?
Ravindra Bagale's Tip – हिंदी
दोस्तों, बहुत से students disconnected table में नया option जोड़ते हैं और उसे SWITCH measure में जोड़ना भूल जाते हैं, जिससे वह blank दिखता है. Table और SWITCH को हमेशा मेल में रखो, और "no selection" के लिए SWITCH को सही default value दो. समझ आया?
Fix common mistakes
| Wrong result | Reason | Correction |
|---|---|---|
| Always shows Sales | Fallback used because nothing selected | Single select with a default |
| Orders shown as ₹3 | One format for the SWITCH measure | Use dynamic format strings or field parameters |
| Slicer filters the chart's cities | Relationship created by mistake | Keep the table disconnected |
Practise independently
Practice task
What does Selected Metric return with no selection?
Hints
- Last argument of SWITCH.
Solution
Total Sales (the default) – ₹2,100 overall.
Think like a professional
You will maintain old reports. Recognising this pattern and migrating it to field parameters is useful on day one of a job.
Revision card