Reputation: 317
https://learn.microsoft.com/en-us/rest/api/power-bi/reports/updatereportcontent#sourcetypeenum
I am using Power BI native application to do this task.
Upvotes: 0
Views: 330
Reputation: 13450
First about question #2 - as you can see in the link you gave, ExistingReport
is the only possible value.
About your first question - you can't do this directly using the API. However, you can use a text value parameter (let's name it ColName
) to hold the name of the column you want to select. Modify the M query for fetching the data from the database by changing it from:
let
Source = Sql.Database(ServerName, DatabaseName, [Query="select Col1, Col2, ColA from Sales.Orders"])
in
Source
to:
let
Source = Sql.Database(ServerName, DatabaseName, [Query="select Col1, Col2, " & ColName & " as ColA from Sales.Orders"])
in
Source
Then use Update Parameters or Update Parameters In Group API to change the value of ColName
parameter (to let's say ColB
). If this is imported dataset, you must refresh it using Refresh Dataset or Refresh Dataset In Group after that.
Upvotes: 1