Read a what-if parameter with SELECTEDVALUE and a default
Turn a what-if slicer into a number your measures can use, with SELECTEDVALUE and a safe default when nothing or several values are selected.
You will learn to
- Explain what a what-if parameter table is
- Read a slicer selection with SELECTEDVALUE
- Choose a sensible default for no selection or a multi-selection
How it works
A **what-if parameter** is a small table of values with no relationships, placed on the report as a slicer. Pedal & Co. has one called `'Price Change'` with a single column of percentages from -10% to +20%. Picking a value filters nothing in the model by itself; a measure has to **read** the selection and use it.
`SELECTEDVALUE(column, alternate)` returns the value when exactly one is selected. When nothing is selected, or several values are, it returns the alternate. Always give it one: for a price change, 0 (no change) is the safe default, so the report shows today's numbers instead of blanks.
Put names with spaces in single quotes: `'Price Change'[Price Change]` is the Price Change column of the Price Change table. Format the measure as a percentage so 0.1 shows as 10%.
Practice it hands-on with a real data model and a live report that updates as you type.
Chosen N = SELECTEDVALUE('Top N'[Top N], 5)