Share via

Field parameter

Denis Scardoni 0 Reputation points
2026-05-15T18:55:33.7666667+00:00

in power bi, how to use a field parameter to switch on/off the visibility of columns in a array/matrix visual ?

Community Center | Not monitored
0 comments No comments

2 answers

Sort by: Most helpful
  1. Gérard Oomens 122.3K Reputation points Volunteer Moderator
    2026-05-15T21:35:20.5666667+00:00

    Was this answer helpful?

    0 comments No comments

  2. Q&A Assist
    2026-05-15T18:55:57.5066667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Use a field parameter as the column field in the matrix and drive it with a slicer; switching columns on/off is done by changing which fields are selected in that parameter.

    1. Create the field parameter
      1. In Power BI Desktop, go to Modeling > New parameter > Fields.
      2. Give the parameter a name (for example, Column Selector).
      3. Add the columns and/or measures that should be optionally visible in the matrix.
      4. Adjust the order and display names as needed in the dialog.
      5. Confirm; Power BI creates a parameter table and (optionally) a slicer for it.
    2. Use the parameter in the matrix
      1. Add a Matrix visual.
      2. Put the field parameter (for example, Column Selector) into the Columns or Values bucket of the matrix, depending on whether the parameter represents dimensions or measures:
        • For switching dimension columns: place the parameter in Columns.
        • For switching measures: place the parameter in Values.
      3. Use the automatically created slicer (or create your own) based on the parameter table to control which fields are active.
    3. Switch columns on/off
      • Report readers use the parameter slicer to select which fields are active. Only the selected fields appear as columns in the matrix; deselecting a field effectively hides that column.
      • From the visual’s field well, use the parameter’s context menu (Show selected field) to control whether the matrix shows the values or the display names of the selected fields.
    4. Optional: edit the parameter in DAX
      • To add or remove fields later, edit the parameter table’s DAX definition. Each row defines a field and its order:
         Parameter = {
             ("Customer", NAMEOF('Customer'[Customer]), 0),
             ("Category", NAMEOF('Product'[Category]), 1),
             ("Color", NAMEOF('Product'[Color]), 2),
             ("Product", NAMEOF('Product'[Product]), 3)
         }
      
      • Keep exactly three elements per tuple (display name, column/measure reference, order) and use unique values for each.

    This setup lets the matrix dynamically show or hide columns based on the field parameter selection, without separate show/hide logic for each column.


    References:

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.