0
votes
  1. Can we change content of Power BI report using Power BI REST API, say in some report 'Col A' has been used and I want to change it to 'Col B'. 'Col A' and 'Col B' are in same dataset and same table.
  2. In updatereportcontent API, what can be the possible value of sourcetypeenum apart from 'ExistingReport'?

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/updatereportcontent#sourcetypeenum

I am using Power BI native application to do this task.

1

1 Answers

1
votes

First about question #2 - as you can see in the link you gave, ExistingReport is the only possible value.

enter image description here

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.