Field parameters in Power BI: let readers pick fields

How field parameters in Power BI let report readers switch the measure or the dimension of a visual with a slicer, creating them, the NAMEOF table behind them, adding fields, hierarchies, a dynamic title, and their limitations.

Short answer: a field parameter is a small table of fields (measures or columns) that a slicer can choose from. Put the parameter on a visual's axis or values, and a slicer next to it switches what the visual shows: revenue, margin or orders; by region, product or channel. Create one in Modeling, New parameter, Fields. Behind it is a DAX table with a name, a NAMEOF reference and an order per field, which you can edit to add fields.

Four copies of the same chart, one per measure, take up a page. One chart with a field parameter slicer above it does the same job in a quarter of the space, and readers pick what they need.

What does a field parameter look like?

  1. 1
    Measure slicerRevenue, Margin %, Orders
  2. 2
    Dimension slicerRegion, Category, Channel
  3. 3
    The chartshows the picked measure by the picked dimension
One chart, two field parameters

How do you create one?

  1. Modeling, New parameter, Fields.
  2. Name it, for example Metric, and add fields: [Revenue], [Margin %], [Orders]. Drag to reorder; double-click a field to rename it as it will show in the slicer.
  3. Leave Add slicer to this page on. Power BI creates the parameter table and a slicer.
  4. Put the parameter field on the visual (Y-axis for measures, X-axis or rows for dimensions).

The DAX Power BI writes for it:

Metric =
{
    ( "Revenue", NAMEOF ( [Revenue] ), 0 ),
    ( "Margin %", NAMEOF ( [Margin %] ), 1 ),
    ( "Orders", NAMEOF ( [Orders] ), 2 )
}

Each row has three values: the name shown in the slicer, the field reference, and the order. To add a field later, edit the formula and add a row, separated by a comma. Keep exactly three columns with unique values: Microsoft notes that extra columns in this DAX are not supported and can lead to unexpected results.

How do you show which field was picked?

A title that says what the chart shows:

Chart Title =
VAR Picked = SELECTEDVALUE ( Metric[Metric], "Several metrics" )
RETURN Picked & " by " & SELECTEDVALUE ( Dimension[Dimension], "several fields" )

Use it in Title, fx, Field value: "Margin % by Region". If the slicer allows several picks, the chart shows them all (several measures, or a hierarchy of dimensions).

What tricks do field parameters allow?

  • Slicer on the parameter's values: right-click the parameter in the Build pane, Show values of the selected field, and a slicer filters the values of whichever field is picked.
  • Hierarchies: a dimension parameter with Year, Month and Day of week, and multi-select, makes a chart readers can arrange.
  • Persist hierarchy level: a report setting keeps the drill level when the field changes.
  • Table columns: a field parameter in a table's columns lets readers choose the columns they see.

What are the limitations?

From Microsoft's list:

  • AI visuals and Q&A do not support field parameters.
  • Readers cannot pick "no field": selecting nothing is the same as selecting all.
  • Implicit measures (a column dragged and summed) cannot be used: write explicit measures.
  • A date column with auto date/time loses its date hierarchy inside a field parameter.
  • Live connections need a local model (DirectQuery for Power BI semantic models) to add parameters.

What goes wrong?

  • Formats that change with the measure. One axis for revenue and a percentage switches formats; each measure keeps its own format string, but axis titles do not change by themselves: turn them off and use the dynamic title.
  • Several picks by accident. A multi-select slicer adds series; set the slicer to single select for measures.
  • Colours per field. A visual colours series by order; colours can jump when the selection changes.
  • Implicit measures. Drag-and-sum columns are not allowed; create measures.

Where can you check this?

Where do you start?

Replace three near-identical charts with one chart and a single-select measure parameter, and give it a dynamic title. Calculation groups switch the calculation (this year, last year, YTD) the same way field parameters switch the field.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.