Edit Queries (data import)
Remarks#
This technique can also be used for other data sources e.g. files, web services.
Note that when you do change these settings, you may have to specify Authentication/Credential details for the new source.
Preventing data source string duplication
By default, when data is imported to the PowerBI Desktop, each table or query stores data source details separately, even if they use the same data source.
This makes it tedious, for example, to change the source database of an entire PowerBI report - which requires changing each query source parameter individually.
There is a way to simplify this, described here.
- Import your data as you normally would. Example:
data source type - SQL server,
server name - localhost
,
database - test1
,
tables - table1
, table2
.
- In query editor, add two blank queries: “Get Data” -> “Blank Query”,
serverName
with value = "localhost"
,
databaseName
with value = "test1"
.
- For each table on the “Queries” pane on the left, select “Source” in “Query Settings” on the right, then substitute server and database names with parameters created in the step 2.
- Now when you need to update your connection string, change
serverName
ordatabaseName
and refresh data.