Hi everyone, we are back again with a new feature in the Power BI Desktop that we will cover in this blog post is Power BI Templates. This feature allows users to export a Power BI Desktop report as a template (PBIT file), which can be instantiated as a new Power BI Desktop report (PBIX file).
A Power BI Report Template contains the definition of the Report, Data Model definition and Queries definition. In other words, a Power BI Report template includes pretty much everything that a Report file includes, with the exception of the data itself.
Today we will walk you through developing a Power BI Template with query parameter, another exciting feature that gives good combination with Power BI template which you will get to know as we will move on.
First we will design a report using map visual in Power BI and AX 2012 ODATA Query Service as its data source.
To design map visual in Power BI, you can refer to one of my blog via: https://www.axpulse.com/tag/google-maps/
Now we will make a query parameter in our Power BI map visual report. As 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.
In Query Editor window, Click on Manage Parameters -> New Parameter and input the following information as shown below:
I had provided Current Value field with my ODATA Query Service URL and ProjectRegionwise at the end of URL is my custom query name in AX 2012. The Current Value field is optional you can also leave it as blank.
As soon as you click on OK, you will see that in Queries pane another query get appear with the name you provided to the parameter.
In our case its AX 2012 ODATA URL, now select ProjectRegionwise query and set its formula to = OData.Feed(#”AX 2012 ODATA URL”) as shown below:
Now Refresh the Preview and then Close & Apply changes. We are just one step away to build a template and you will see the automation that will be provided by our query parameter.
Click on File -> Export -> Power BI Template and fill in the Description as shown below:
Press OK and specify the location to save the template file. The template will get save with extension .PBIT, Notice that the size of Power BI template is always less than its original Power BI report .PBIX file as you can see in the screenshot:
Open the recently created template file by double clicking on it or import it through Power BI Desktop. You will see a dialog prompting you to input your ODATA Query Service URL that is the query parameter we had created while developing the Power BI Template.
After providing the dialog with your AX 2012 ODATA Query Service URL, a new Power BI Desktop report based upon the contents in the template file would be created exposing your own data in map visual.
That’s all about Power BI Template. I hope you get better understanding of building Query Parameter with Power BI Template because together these rock the Power BI plateform.