Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
HIi
I'm working on creating an excel report that collects data from a local copy of a SQL Server database on my maschine, where I use Power Query to retrieve the data. These are then loaded into a PowerPivot data model. Now I'm finished with the development and on my way to put this into production on another server on the customer's server. The Excel workbook must change database settings using sql server database user Connection (not integrated). I had hoped that I could change the database Connection Properties at the Data tab, but there are not any easy way to change the connection string to the new server. Now I can't see any option that going through every Power Query query and change them manually. I have great hope that you Power Query experts have a Nice explaination and an example how I can solve this.
Regards Geir F
Solved! Go to Solution.
Hi @Anonymous,
You can refer to below method: use custom function and query parameters to load data.
Custom function:
let Custom= (ServerName as text,DataSource as text, SQLQuery as text) as table=> let Source = Sql.Database(ServerName, DataSource,[Query=SQLQuery]) in Source in Custom
Parameters:
Use:
let Source = LoadData(ParaServerName,ParaDataSource,ParaQuery) in Source
After above steps, you can modify the parameters to change the datasource.
Regards,
Xiaoxin Sheng
Hi @Anonymous,
You can refer to below method: use custom function and query parameters to load data.
Custom function:
let Custom= (ServerName as text,DataSource as text, SQLQuery as text) as table=> let Source = Sql.Database(ServerName, DataSource,[Query=SQLQuery]) in Source in Custom
Parameters:
Use:
let Source = LoadData(ParaServerName,ParaDataSource,ParaQuery) in Source
After above steps, you can modify the parameters to change the datasource.
Regards,
Xiaoxin Sheng
Hello again.
Take a look at suggested method above. If I want to set a SQL SERver authentication together with servername, user name and password, how will these 3 parameters look like?
regards GEir F
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
75 | |
54 | |
38 | |
31 |
User | Count |
---|---|
99 | |
56 | |
50 | |
42 | |
40 |