Field Parameter tips and gotchas

Generated using Microsoft Designer (first attempt only)

Field Parameters are a powerful tool that enable dynamic interactivity that would otherwise be impossible within your Power BI Reports. We most often leverage them when setting up "toggling" one or more dimensions and measures.

I recently spent a several hours stretching the limits of Field Parameters while trying to create a report builder-type interface (similar to what we used to do in QlikView). I struggled with a few things, plus found a few tips. Hopefully these will save you some time.

1. You can't create Field Parameters purely from DAX

Copying the DAX from a Field Parameter and using it to create a new DAX table does not result in a Field Parameter. The resulting table will be recognized as a normal table, not a Field Parameter. While this new table could potentially be updated or fixed using Tabular Editor, no settings within Power BI Desktop currently enable this.

If you have DAX ready to go that you'd like to use to create a Field Parameter, the fastest way I’ve found to use it in a new Field Parameter is to:

  1. Create a new Field Parameter from the Modeling menu with your desired name
  2. Add any field or measure (one is enough)
  3. Finish the creation process
  4. Overwrite the generated DAX code with your custom DAX

 

DAX behind a field Parameter


2. Field Parameter table column order is fixed

The order of the three automatically generated columns in a Field Parameter table are fixed. Changing them risks breaking the Field Parameter. If you need to add columns to your Field Parameter table, append them at the end and leave the original where they are.

3. Sorting a Field Parameter by other fields doesn't work

Sorting a Field Parameter by another field isn't possible, unlike other typical table columns. Instead, to control the display order, simply add the items to the Field Parameter in the order you want them to appear.

4. You can make a Field Parameter conditionally show/hide in a visual

"Turning off" the dimension in this report builder prototype

You can make a Field Parameter column disappear entirely from a chart when a certain value is selected, like a hardcoded "None" value. Barney Lawrence outlines a clever trick for this here. See below for an example.

Chart Legend = {
("None", "None", 0),
("ChannelName", NAMEOF('Channel'[ChannelName]), 1),
("ContinentName", NAMEOF('Geography'[ContinentName]), 2)}

5. You can return the currently selected value in a Field Parameter... but not with the SELECTEDVALUE or VALUES function 

Scenario: You'd like to display the currently selected dimension name from a Field Parameter as a dynamic chart title, ex., "Sales by [dimension selected in Field Parameter]". Unfortunately, SELECTEDVALUE doesn’t work on the first column of a Field Parameter table. Fortunately, SQLBI offers a workaround with an explanation of why SELECTEDVALUE fails in this scenario. You can check it out here. Below is the recipe you can clone. (This solution is used to create the dynamic visual title in the above gif.)

VAR __SelectedValue =
SELECTCOLUMNS (
SUMMARIZE ( Parameter, Parameter[Parameter], Parameter[Parameter Fields] ),
Parameter[Parameter]
)

6. You can't nest Field Parameters

You can't add a Field Parameter to another Field Parameter. Power BI will technically allow you to add it, but it won’t function.

Contact Form

Name

Email *

Message *