What are Fields Parameters in Power BI
Fields Parameters make your dashboard more dynamic and interactive. Example is shown below to enforce its relevance by using Dimensions and Measures.
Dimensions are categorical fields or discrete date types which can be grouped together. Measures are numerical fields or continuous date types which can be aggregated. Aggregated simply means we can use to e.g. sum(), count() or so forth.
Dimensions
If we start with simple Bar Graph where Sales are on the Y-axis and Categories on the x-axis. Now, we want to see Countries instead of Categories to get split of Sales by City then we need to manually drag and drop City and take Categories out.
Now, to make this process more dynamic this is where Field Parameters come in. You can find Fields Parameter within the Modeling tab
Once we click on Fields option we get a pop-up menu where we can rename the parameter and drop in all the fields we want to use dynamically.
Once you click “create”, it creates a new table which is not connected to any other table within the Data Model. If click on the table it shows three columns where two are hidden.
The 1st column shows the list (Name) of fields, 2nd is the field name and 3rd is the sort order.
Once the parameter is created we can pop it in the view. However, if we click on the buttons nothings happens becuase it is still not connected to the view.
So, to connect the parameter to the view we would need to drop it within the view. So, we would replace Categories column in the X-axis with the newly created parameter.
Now, we the parameter will work and if we switch to City it will dynamically show the Cities.
Updating the List
We currently, have two fields but we want to add another fields. How would we do it?
- First we would click on the table within the Fields section.
2. Then once we click on the table go to the formula bar. The formula bar will show DAX expression to get these fields. We can simly tweek/update the formula by copying one of the lines and pasting it below.
After copying it we can rename the field we want and in the 2nd part refer to the right table and change sort order to 2. The sort order is following index order where 1 is 0.
We can get also use the 3rd field.
Measures
We looked at dimensions but now we look at how we can also use Measures within Fields Parameters. Repeat the same for Measures to create a parameter. The only difference is that within the Fields section we will select Measures instead of Dimensions.
Till now we were using Sales on Y-axis but now we would replace it with the newly created Measures Parameter.
If we just change the bar graph to stacked bar graph and add the Dimensions Measures to the legend. Then it would something like below. Were both X and Y-axis are dynamic.
Additional Visual Changes
If we want to see the a button for Measures parameter then we can go to visual pane and Selection we can only select “Single Select” and take off the Slicer Header. Then we would get buttons.