Since April 2017 it is possible to build reports on top of datasets that are hosted in the PowerBI service. This was announced and described here and here in more detail. This might not seem like a big deal at first sight, but it can have a huge impact on how you work with PowerBI. By separating the data model from the report, you can have two or more independent people working with the same dataset. Also, the people who build the reports in the end most not necessarily have the knowledge to build a data model – the just need to use it. So, there are some clear advantages when you split up your workbook:
- separation of duty (data modeler vs. report builder)´
- any number of reports on top of the same model
- easy control over reports as the files are quite small (they only contain the definition of the report)
This is all pretty cool and, from my point of view, the way to go once you want to use the reports in production and/or have several people working on/with the same reports.
But lets go a step further. After some time, as your data model grows, you realize that the reports get slow and also the processing takes a considerable amount of time to finish. The official upgrade path will then guide you to Azure Analysis Services and you will migrate your data model to deal with the larger data volumes and make use of the flexibility in processing you gained by your upgrade. This migration process is very well described here.
So far so good, but what happens to your reports? Last week I was in exactly the position described above and we had to migrate the existing reports (which were base on a dataset hosted in PowerBI) to Azure Analysis Services. As of now, there is now simple way to simply change the connection string from PowerBI to Azure Analysis Services neither in PBI Desktop nor in the Service. But we could think of some options how it might work:
- rebuild all reports
- use the REST API to update the connection string of the existing reports
- modify the .pbix file manually (NOT OFFICIALLY SUPPORTED)
As you can imagine, rebuilding all reports was not really an option.
The next option, the PowerBI REST API looked pretty promising at first sight. It allows you to retrieve and set the dataset that is used by your report. So the idea is to simply create a new dataset which points to Azure Analysis Services in Live Query mode, take the existing report and use the Rebind API call to bind it to the new AAS dataset. Even though this is supposed to work, I could not make it work in my environment. I tried all things that I could think of but nothing work and I also gave up on this.
So I was stuck there but knew that the information of the data source has to be somewhere in the .pbix file. In the past I already did something similar with Excel/PowerPivot files (“Restoring a SSAS Tabular model to PowerPivot”) so I thought I would also give it a try for .pbix files. And it turns out that they are quite similar. For those of you who are new to this, most (if not all) of the files that are associated with a Microsoft tool and end with “x” (e.g. .xlsx/docx/…) are just ZIP-files in the end. To unzip them, simply rename them to .zip and use your favorite zip-tool to open them. You will see a file-structure similar to the one below:
(If your file contains a data model, you see a file called “DataModelSchema” instead of “Connections”. The next steps will not work in this case!). However, in our case, as the report is linked to a dataset hosted in the PowerBI service, our file does not contain any data itself but only the connection information to our data source. As you can guess, this information is stored in the “Connections” file.
To see what a connection to an Azure Analysis Services dataset looks like, I simply created a new PowerBI desktop model and established a Live Connection. Saved it and opened it again as zip file. The Connection file itself is just a JSON but the details are not really relevant here. I simply replaced the Connections file from my original report with the one from my new workbook linked to AAS. Renamed it back to pbix, opened it and voilà, my report was connected to AAS!
This saved us a lot of time and we could move all of our reports within a couple of hours!
Please keep in mind, that this is not officially supported and might break your model. So make sure to always create a backup before you modify the contents of a pbix file manually!
I do not take any responsibility for any broken models or anything else that might happen!
“not officially supported” – Thanks Gerhard – Lot of things are like that – For e.g – using Power Query to connect to an Excel file stored on One Drive Personal – but it works ! and that is what counts
Sadly this is no longer working, probably because of the update of PowerBI of June2019. Do you know any way to do exactly the same thing after this update?
Hope to hear something soon.
Thanks in advanced!
I have not had a look recently but the file format might has changed. As it was never officially supported to modify the content of the .pbix it was kind of expected that this will not work forever 🙁
As of now I don’t know of any alternatives, sorry
Thanks anyway! If someone finds a way, please let us know ?
I solved it!
When you unzip the pbix, a file called “SecurityBindings” is created and must be deleted to be able to open the pbix after you have already changed the files inside and then zip it again.
Thats great news David!
However, please keep in mind that changing the .pbix manually is not supported and may break some things