With last update Microsoft has introduced a new release that permit user to use parameters in power bi desktop. let’s go and see hot to use parameters in power bi:
We start from a existing model, in particular i select my previous FIlm Analytics Model. And i started from Query Editor :
From this page i select Parameters Icon on the Home tab, and click new parameter:
We start from this Window:
My edition is in italian to simplify the usage i have inserted a Number near the different objects:
- it is the List of all yor Parameter, in our case this is the first
- it is the name of your parameter, i call it YEAR
- it is the description tab, where you can write what parameters do fi you want to rember it
- We can decide if the paramater is obbligatory or not
- It’s the type of paramter, we can select date, Number, text, duration, hour. IN our example i selec Number
- Here we can select if user can insert every kind of value or a specific dataset, if i change and select List of value i have this situation :
Where we have:
- The list of value that user can select, in our example i have wrote in it the last 4 years
- It is the default value if user not select anything
- it is the actual value when i refresh my data
In our example the final result it’s :
When i click ok power bi create a new Page with you parameter name:
Once one or more parameters are available in the current file, users can reference those parameters via the UX.
Referencing parameters is currently supported via the Data Source dialogs, Filter Rows, Keep Rows (top/bottom, etc.), Remove Rows (top/bottom, etc.) and Replace Values. In addition, Parameters can be loaded to the Data Model just like any other queries, allowing references from measures, calculated columns/tables and report elements.