Introduction to Parameters
Parameters are great helpers to obtain a full control over your queries. When used correctly, they become a time-saving and error reducing solution.
This mere introduction to parameters explains how to easily pass a parameter to filter a query.
Here is a little helper to encourage you practising:
1. Import a dataset and create a query:
Curious people: note we can create Parameters from blank query.
2. Configure one or several parameter(s):
Do not forget to make the most of List of values and Type boxes.
3. Apply the parameter in a query:
I am using Insert Step After by right clicking last command showed in Applied Steps pane:
4. Terminate by editing the M formula bar:
This expression passes Parameter1 value to filter BrandName column
= Table.SelectRows( Demo_Table, each [BrandName] = Parameter1)
This one filters out Parameter1 value from the BrandName column filter
= Table.SelectRows( Demo_Table, each [BrandName] <> Parameter1)
You are free to pass Parameter1 value to other compatible column of the dataset:
= Table.SelectRows(Demo_Table, each not Text.Contains([Manufacturer], Parameter1))
Working with numerical values or dates, this option proves to be extremely powerful.
More transformations accept parameters as arguments.
Replace value Value to find/ replace fields:
Value and Output on Conditional columns
If you need it, you can call and edit parameters values directly in Power BI Desktop. This operation de-facto implies a data refresh, so make sure it is the right moment to do it!
The slides describing the filtering technique goes below:
I hope you enjoy the read.