Forum Discussion
Connection to different environment in PBI Desktop
- 2 years ago
I resolved the issue by adding the data source in Data source setting.
File ->Options and setting -> Data source setting -> and there added other data sources to the list and it works to select other DB servers.
Hi Trodo737 ,
You can use parameters to connect to different environments in the same report. The Below are the steps you can take to connect using parameters
Create Parameters:
- Open Power BI Desktop and go to the Home tab.
- Click on Manage Parameters and select New Parameter.
- Name your parameter (e.g., “ServerName”) and set the type to Text.
- Add the possible values for your parameter (e.g., different server names) and set the default value.
Use Parameters in Queries:
- Go to the Home tab and select Transform Data to open the Power Query Editor.
- In the Power Query Editor, select the query you want to parameterize.
- Click on the Advanced Editor and replace the static parts of your connection string with the parameters you created. For example:
let Source = Sql.Database(ServerName, DatabaseName) in Source
Apply Parameters:
- After setting up your parameters, go back to the Home tab in Power BI Desktop.
- Click on Transform Data > Data Source Settings.
- Select the data source you want to parameterize and click on Change Source.
- Replace the static values with the parameters you created.
You can try the above steps to setup connection using parameters.
You can then use the parameter in slicer and try changing the value and see if it works with new connection
Regards,
Thank you Thejeswar . I'm using the new version of PBI Desktop and it seems that the new one doesn't have this option anymore(for creating parameters for datasources https://www.phdata.io/blog/how-to-parameterize-data-sources-power-bi/). I found 'New parameters' under 'Modeling' but there is only option for numeric and field.