Forum Discussion
Dynamically change data source of published report
- Anonymous9 years ago
Hi aroyappan,
As GilbertQ said, if you want to dynamic change the datasource, you can refer to below steps:
1. Create a table with these datasources.(id, server name, database name , item)
2. Write a power query custom funciton which used to analysis the records and connect to datasource.(function parameters: server name, user name, password)
3. Filter the datasource table and use the filtered records to inveke the custom funciton.
Sample of sql database
let loadData=(Servername as text, DbName as text, itemName as text)=> let Source = Sql.Databases(Servername){[Name=DbName]}[Data]{[Schema="dbo",Item=itemName]}[Data] in Source in loadDataUse:
Table structure: id, server name, db name, item name
let Selected = Table.SelectRows(SourceTable, each [id] = 10), ServerName= List.First(Selected[server name]), DBName= List.First(Selected[db name]), ItemName=List.First(Selected[item name]), Source= loadData(ServerName,DBName,ItemName) in Source
Regards,
Xiaoxin Sheng
Hi aroyappan,
As GilbertQ said, if you want to dynamic change the datasource, you can refer to below steps:
1. Create a table with these datasources.(id, server name, database name , item)
2. Write a power query custom funciton which used to analysis the records and connect to datasource.(function parameters: server name, user name, password)
3. Filter the datasource table and use the filtered records to inveke the custom funciton.
Sample of sql database
let
loadData=(Servername as text, DbName as text, itemName as text)=>
let
Source = Sql.Databases(Servername){[Name=DbName]}[Data]{[Schema="dbo",Item=itemName]}[Data]
in
Source
in
loadData
Use:
Table structure: id, server name, db name, item name
let Selected = Table.SelectRows(SourceTable, each [id] = 10), ServerName= List.First(Selected[server name]), DBName= List.First(Selected[db name]), ItemName=List.First(Selected[item name]), Source= loadData(ServerName,DBName,ItemName) in Source
Regards,
Xiaoxin Sheng
Suppose we have multiple different SharePoint sites with same data schema and I want to query all of them dynamically based on say an initial query with the list of sites and merge the data. Is it possible ?