This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Two of the new features in the Power BI Desktop April Update are Query Parameters and Power BI Template files. In this blog post, we will take a deeper look at the new capabilities and scenarios that these two features enable in Power BI.
At a very high level, Query Parameters allow users to easily make parts of their reports and data models (such as a query filter, a data source reference, a measure definition, etc.) depend on one or more parameter values. On top of this capability, Templates allow users to export the definition of a report (report + data model + queries definition + parameters, if any) without including the actual data. Users can easily instantiate a Template using Power BI Desktop, which will ask them for parameter values (if needed) and create a new Power BI Desktop Report (PBIX file) based upon the contents in the Template file (PBIT file).
Let’s take a closer look at how this can be done…
From this dialog, users can create new parameters and specify metadata and settings for each parameter:
After defining one or more parameters and clicking OK in the “Manage Parameters” dialog, users will get back to the Query Editor dialog and will see a new query defined for each parameter. Note that Parameters are just like any other query in Power BI Desktop; they can be referenced from other queries, loaded to the Data Model and reference in DAX expressions, etc. By default though, Parameters are not loaded to the Data Model, so users have to right-click on a parameter and select “Enable Load” if they want to have them loaded to the Data Model.
Now that users have defined one or more parameters, they need to specify how they are being referenced or used by other queries. We’re adding support via the most common UX dialogs to accomplish this. Currently, most of the Data Source dialogs support referencing parameters on each input field. Once users have parameters in a Power BI Desktop report, and they access a data source dialog, they will see a new widget that allows them to switch the input mode for a given input box. The two supported modes are “Enter a value” (i.e. a static value) or “Parameter” (to reference an existing parameter from the PBIX file).
In addition to Data Source dialogs, parameters can also be referenced from the “Filter Rows” dialog and the “Replace Values” dialog. In future updates, we will add support for referencing parameters from other dialogs, such as the “Insert Conditional Column” dialog.
After Query Parameters have been referenced from other queries as needed, users can hit “Close & Apply” in the Query Editor ribbon to get their data and parameters loaded into the data model. At that point, they can start creating the report and even reference these parameters from DAX expressions, such as the one in the following screenshot.
Within the Report view, users can edit parameter values by using the “Edit Parameters” button in the Home ribbon tab (under “Edit Queries”).
This will bring up a dialog to allow users to reconfigure parameter values and will refresh the data and report visuals based on the new parameter values.
Note that currently, parameter values can only be modified within Power BI Desktop. We’re actively working on ways to allow users to change parameter values within PowerBI.com for published reports consumed via the Web experience.
To summarize, Query Parameters allow users to:
A Power BI Report Template contains the definition of the Report (pages, visuals, etc.), Data Model definition (schema, relationships, measures, etc.) and Queries definition (collection of queries, including Query Parameters, etc.). In other words, a Power BI Report template includes pretty much everything that a Report file includes, with the exception of the data itself. When a user tries to instantiate a template, either via double-click on the PBIT file, or by using the “File –> Import –> Power BI Template” path, a new Power BI Desktop file will be created, containing the actual data based on current user’s credentials for data sources, etc.
In order to Export a Power BI Template, users can click “File –> Export –> Power BI Template” from the main Power BI Desktop window.
This will bring up a new dialog where users can provide a description for the template, followed by a Save File dialog where they can pick the name and path to save the template file to.
Notice how the file size of a Power BI Template (PBIT file) is much smaller than the size of a Power BI Report (PBIX file). Well, in this case, not that much since my dataset size was small anyways… : )
Now that users have created a Power BI Report Template, they can use it to instantiate new Power BI Reports on their machine, or share the template file with other users to let them create new Power BI Reports based on this template. There are two ways in which users can consume a Power BI Report template:
As part of importing a template, users will be asked to provide values for parameters defined in the template. For instance, importing the “Customers by Country” template that we created in the previous steps will prompt users to select a Country value from the list of accepted values that we specified while defining the parameter.
Once Parameter values have been specified, a new PBIX file will be created, containing all Report pages, visuals, data model artifacts and queries as the original PBIX file, but containing the data based on the current user’s credentials and parameter selection.
Do you find Query Parameters and Power BI Report Templates valuable? If so, we encourage you to try this feature using the latest Power BI Desktop version and share feedback with us via our usual channels (Smile/Frown, Community Forums, UserVoice Feature Suggestions, etc.). You can also download the Power BI Report Template that I created in this blog post to explore the contents in more detail.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.