Back to PowerBI & DAX Measures
PowerBI & DAX Measures

How to implement dynamic measure switching in PowerBI using Field Parameters?

Use a Field Parameter with a SWITCH‑based master measure to dynamically swap DAX calculations in Power BI reports.

R
Rahul Sharma 👑 Tier 3 Elite
Aug 9, 2026 · 1 min read

Create a Field Parameter that lists the target measures and use a single switch measure that selects the appropriate calculation based on the parameter value.

Step‑by‑step implementation
1. Build a disconnected table of measure names
```dax
MeasureList = DATATABLE(
"MeasureName", STRING,
{
{"Sales Amount"},
{"YoY Sales"},
{"Cumulative Sales"},
{"Sales % of Target"}
}
)
```
2. Create the Field Parameter
- In Power BI Desktop, go to Modeling > New parameter > Fields.
- Select MeasureList[MeasureName] as the source column.
- Enable Add slicer to this page.
- The generated table (Parameter_Measure) contains a column Parameter_Measure[Name] and a hidden numeric column used for sorting.
3. Add the parameter slicer to the report canvas; set it to Single select for clarity.
4. Write the master switch measure
```dax
Selected Measure =
VAR _choice = SELECTEDVALUE(Parameter_Measure[Name])
RETURN
SWITCH(
TRUE(),
_choice = "Sales Amount", [Sales Amount],
_choice = "YoY Sales", CALCULATE([Sales Amount], SAMEPERIODLASTYEAR('Date'[Date])),
_choice = "Cumulative Sales", CALCULATE([Sales Amount], FILTER(ALLSELECTED('Date'), 'Date'[Date] <= MAX('Date'[Date]))),
_choice = "Sales % of Target", DIVIDE([Sales Amount], [Sales Target]),
BLANK()
)
```
5. Performance tip – If you have many measures, replace the SWITCH with a calculation group that references the same Parameter_Measure[Name] column; this reduces model size and improves query plans.

Quick comparison
| Approach | Pros | Cons |
|---|---|---|
| Field Parameter + SWITCH | No external tools, works in all service tiers, easy to maintain | Switch statement grows linearly with measures |
| Calculation Group | Single definition, optimal for >10 measures, better storage | Requires Premium capacity (or Power BI Embedded) |
| Separate slicer per measure | Visible explicit options | Clutters UI, duplicate logic |

Use the Field Parameter when you need a lightweight, universally deployable solution; switch to calculation groups as the measure count scales.

Read the evidence

Sources used in this thread

Open the original material, compare the claims, and form your own view.

Community notes

Add context, not noise (0)

Corrections, lived experience, useful examples, and better sources belong here.

Nothing added yet. Be the first to make this thread more useful.
Click here to write a reply...
🔒

Authentication Required

Join Trendzza to begin your journey. Submit tasks, complete batches, help peers, and earn your way to Tier 3.