Create a dynamic slicer with field parameters with core visual – #PowerBI

Last week I found a nice little hack that enables us to create a dynamic slicer with one or more levels and let the user pick the different levels in the slicer.

This has been very useful in one of our solutions for our clients where it can limit the number of slicers needed in a report.

First we will create a field parameter in our model where we add the different fields we want to be able to slice on

Modeling

From the product table I select different fields and place them in the order I would like them sorted.

parameters

Just leave the “Add slicer to this page” on to add a slicer by default and the slicer looks like this.

product level selector

Now add a table to the page and add the field parameter as the columns field.

product table

As we haven’t selected any fields from the slicer, we will see all the different values in the fields.

Now change the visual to a slicer (not the new button slicer) and notice what happens.

Pause
The visual is now a slicer containing the values from the different fields.

visual

And you can now select the fields you want to have in the slicer

product level selector

And if you want them in another ordinal level you select the first level and then CTRL click the next the level – in this example Class and then Category

product level selector

And notice the slicer header is automatically populated with the field names

You can download a sample file – here.

About the Author

Hey – I blog about Power BI and other elements in the Power Platform and do talks in the Community

References

Svensen, E. (2023). Create a dynamic slicer with field parameters with core visual – #PowerBI –, Available at: https://eriksvensen.wordpress.com/2023/11/27/create-a-dynamic-slicer-with-field-parameters-with-core-visual-powerbi/ [Accessed: 25th March 2024].

Share this on...

Rate this Post:

Share: