A measure picker: let a slicer choose what a chart shows
Build one measure that shows sales, quantity, orders or customers depending on a slicer, with SWITCH and SELECTEDVALUE.
You will learn to
- Build a measure picker from a disconnected table
- Map each text option to a measure with SWITCH
- Give the picker a sensible default
How it works
Instead of four nearly identical charts, give the report one chart and a slicer that chooses what it shows. The `Metric` table lists the options as text: Sales, Quantity, Orders and Customers. It has no relationships; it only exists to be clicked.
The measure reads the selection with `SELECTEDVALUE(Metric[Metric], "Sales")` (Sales when nothing or several options are picked) and hands it to `SWITCH`, which pairs each option with the measure to return: `SWITCH(value, "Sales", [Total Sales], "Quantity", …)`.
Each branch returns its own measure, so its own filter logic still works: Customers stays a distinct count in every row and never gets added up.
Practice it hands-on with a real data model and a live report that updates as you type.
Selected Period = SWITCH(SELECTEDVALUE('Date'[Quarter], "All"), "Q1", "Winter", "Q2", "Spring", "Q3", "Summer", "Q4", "Autumn", "Full year")