Power BI released a new preview feature called Field Parameters in May 2022 update. Using Field Parameters you can dynamically change the measure or dimension on visuals to analyze the data.
Lets enable the Field parameters feature, go to Option & Settings option then click on Preview features then check the Field Parameter option as shown below.
Creating a Field Parameter to change the dimensions dynamically on slicer selection
As you can see, here we have a simple clustered column chart which displays the Total Sales and Total Profit by Products.
Now you want to see the Total Sales and Total Profit by Segment on same chart. Means you can dynamically switch the Dimensions based on slicer selection and it can done easily by using Field parameters.
Lets implement the Field parameters. To create a new field parameter, go to the Modeling tab, select New parameter > Fields as shown below.
Lets click on Fields and you will see a pop up window Parameters opens.
Now, here you need to choose the columns that you want to be a part of the user selection.
Lets select Product and Segment or you can simply drag them as well.
In case, if you want to display the fields in any specific order in slicer then you can drag the fields up and down to change the order of the fields accordingly.
Also, you can change the name of fields, just double-click any of the selected fields to change the name.
keep Add slicer to this page option ticked, it will add a slicer on your report page automatically.
After that click on Create button.
Now, you will see a slicer is added on the report page as shown below.
Also you will see a newly created table in your report.
Now go to chart’s setting and take By Selection field on X-axis as shown below.
After that lets select the, Segment on slicer and you can see x-axis is changed to Segment.
Also, if you do not select any value on slicer it will show Segment and Product details on X-axis.
So, to see the all level of details on chart you need to expand all level of hierarchy on chart and then sort the axis as shown below.
Once you sort the axis, you can see all level of details on chart. Basically, all the fields those are selected in slicers.
Creating a Field Parameter to change the measures dynamically on slicer selection
So far we have seen, How to change the dimension dynamically based on slicer selected values, In a similar way we can change the measures as well.
Lets show the Total Sales and Total Profit dynamically based on slicer selection.
Now repeat the same steps as we did earlier, and you can see here we have selected the Total Sales and Total Profit measures and the name given to Parameter is By Measures as shown below.
Once you click on create button, you will see a table named By Measures is created also you can see the slicer is added on your report page.
Now, remove the Total Sales and Total Profit measures from chart’s Y-axis and take the By Measure as shown below.
As of now, chart is showing Total Sales and Total Profit values because both measures have been selected on slicer.
Lets select Total Sales only from slicer, but before that lets turned on the Chart’s X-axis and Y-axis title which help us to validate what values are being displayed on chart.
Now you can see, on Y-axis we have Total Profit and Total Sales.
Lets select Total Sales from slicer, and you can see now chart is showing Total Sales only.
As we have implemented Field parameter for both X-axis and Y-axis, so we can show any selected dimension and measures dynamically on chart. This is the best use case of using Field Parameters.
Lets see the Total Profit by Segment on chart and you can see chart is showing data based on selection.
Also, you can see the DAX code generated by Power BI for field parameters that you created. Lets click on table By Measures and select the column as shown below.
You can see the DAX code in formula bar. In case, if you want to modify order of fields, add new field, remove any field or rename the field, you can quickly modify here.
190 total views, 2 views today