Welcome back to this week’s edition of the Power BI blog series. This week, I look at how parameters created in Power Query are updated in Power BI.
I have extracted some data into Power BI:
I create a column to indicate if my students pass or fail (a hard coded 40% seems a fair pass mark!):
Pass = IF([Result] > 40, “Pass”, “Fail”)
I decide I will use a parameter to determine the pass level, and so that I may link it to an Excel workbook later, I will create the parameter in Power Query. I choose ‘Transform data’ from the Home tab, available on Data view or Report view:
This takes me to the Power Query editor, where there is a ‘Manage Parameters’ option on the Home tab:
I choose to create a ‘New Parameter’:
I ensure that the Type is ‘Decimal Number’ (since I can’t pick whole number here), and I set the value to 50. I save the parameter and set it to load to Power BI:
I then ‘Close & Apply’ from the Home tab, and my parameter appears in the Fields pane:
On the Data view, I amend the column Pass to use the parameter P_PassMark:
Pass = IF([Result] > P_PassMark, “Pass”, “Fail”)
Since P_PassMark is currently set to 50, Bob now fails!
On the Home tab on the Report view or the Data view, I can ‘Edit Parameters’ from the ‘Transform Data’ dropdown:
I can change P_PassMark back to 40:
I click OK, and I am prompted to commit the changes to the Power Query parameter:
I do this, but Bob has still failed!
Since a Power Query parameter could be linked to an external source, I need to refresh the data to see the change. I can do this from the option to the right of ‘Transform Data’ on the Home tab:
P_PassMark has been updated, and Bob has passed!
Check back next week for more Power BI tips and tricks!
Be the first to comment