I currently work at a company where I design PowerBI reports for our clients. Having a large number of clients, I would like to automate the process of creating and maintaining the reports with code.
In idea, I would like to be able to get the code for a "master report" so that we can modify it directly with code without having to open PowerBI. This would not only automate the process of creating a report by duplicating the master report and making all the necessary modifications with code, but also its maintenance. Indeed, when we make a change in a report, we must currently do it manually for all other clients which is very time consuming.
The structure of the reports is identical for each of the clients except for a few details:
- The SQL query to connect to BigQuery to get the client's data
- The pages that are shown or hidden (depending on the client, the same number of pages are not shown)
- The title of 2 slicers
- The presence or not of 2 slicers depending on the presence of attributes associated with the slicer in the database.
- The title of some pages
I have done a lot of research on how to do this, I have done some tests but I can't really find a solution that works. Here are the tracks I explored:
- Power BI Rest API, which allows you to duplicate a report, change the parameters of a report (so potentially the SQL query) but not change the visual of the report.
- PowerBI Javascript API, which obviously allows you to direct the visual of the report with code by embedding it in an application, but the visual changes do not seem to apply directly to the report in PowerBI service but just in the application. Also, I don't see any methods to change the title of a visual or hide a page.
- Extract the code from the .pbix file by converting it to .zip. However, when I modify for example the displayname attribute of a slicer in the Layout file and convert the .zip file back to .pbix, an error message appears indicating that the file is corrupted.
Do you know if one of the tracks I mentioned can achieve what I want to do? Is there any other way to automate the creation and maintenance of reports?
Thank you in advance for your advice!
Melvin