Forum Discussion
Use PBI Template with parameter for different database??
- 6 years ago
Hi, MojoGene
I'd like to suggest you create three parameters as below.
Then you may click 'Advanced Editor' and parameterize the data source. I use SQL Server to test.
Then you need to save it as a template file(pbit file).
When you open the pbit file, you may input the corresponding parameter to connect to the specific table.
For further information, I'd like to suggest you refer the following links.
Create report templates for Power BI Desktop
Deep Dive into Query Parameters and Power BI Templates
Power BI Desktop Query Parameters
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Pat:
Thanks for jumping in.
I could create a list with the database names for each Company. That seems simple enough. But how do I pass the selected list value as the Source for each table in the database?
Create a custom function in query editor and in the query with the table with the list of database names, on the Add tab choose Invoke Custom Function, choosing the column with your database names as the input paramter. See this post for instructions.
To create the function, make a query that does what you want with one of the database, and then modify the query in advanced editor, replacing the database name with the name of your parameter. In example below, the parameter name is in parentheses. The values from your table of names is inserted there when you invoke custom function.
(databasename) =>
Source = sql.database(actualservername, databasename, ...)
If this solution works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat