Introduction
In this article, I will use that parameter (in my case it was ‘Database’). I have two databases in my SQL Server i.e. ‘MyDB’ and ‘AdventureWorks’. In the ‘MyDB’ database, I have two tables ‘Department’ & ‘Employees’ and in ‘AdventureWorks’ I have only one table ‘SalesPerson’.
My task is to import these tables in Power Query editor using my parameter. So, try the below steps:
Step 1
Let’s have a look at the parameter in power query editor in the below image:
Now I will import data from the SQL server. To do so click on ‘New Source’ and select ‘SQL server’
After clicking on the SQL server source, you will find a new window of the SQL server database. Here, you should provide the Server Name and Database. In the database option, I will choose ‘Parameter’. See the below image
Now click on ‘Ok’. Give the alternate credential or choose ‘Use my current credentials’ and then click on ‘Connect’.
Select the checkbox of the table and click on ‘Ok’.
Once you click on ‘Ok’ you can see that your table or tables of the given database will be showing on the left side of the editor window. In my case, I have only one table in my ‘AdventureWorks’ database. See the below image.
Step 2
Now I will modify my parameter to access the tables of another database i.e. ‘MyDB’.To do so go to the parameter and click on ‘Manage Parameter’.
Change the current value and select ‘MyDB’.
Now go to ‘New Source’ and click on ‘SQL Server’, provide the server name, and select parameter in the database as I have captured in the first step then click on ‘Connect’.
Select all the tables of this database and then click on ‘Ok’.
Now you can see that your second database will be connected and all tables of this database getting imported in the editor window which is shown in the left pane.
Summary
Parameters are a very useful feature of Power BI. Hope you understand how to use the query parameter in the query editor. These were the simple steps to import data from the SQL server using parameters. You can also check the below link for one more use of parameters.
Similarly, you can try to import the data from another type of source with the help of parameters. Thanks for reading.