Do you know this message? “This file can’t be downloaded yet. You can’t download this file right now because it’s been modified using an XMLA endpoint.” How to copy the Power BI data model back to a PBIX file anyway, I describe in this post.
NOTE: The workaround described here is not officially supported by Microsoft. If you use this workaround, you do so at your own risk.
- pbi-tools (extract and compile the PBIX file)
- XMLA-Endpunkt (read the data model – Power BI Premium functionality)
- Tabular Editor (extract and save the data model)
To begin, we create an empty PBIX file by opening the Power BI Desktop and going directly to “File > Save As” to save the file. In this example I call the file “Container.pbix”.
Now we extract the PBIX file using pbi-tools and the parameter “-modelSerialization Raw”. The parameter ensures that the model information is not split between directories and files, but is stored in a database.json file (BIM file).
pbi-tools extract '.Container.pbix' -modelSerialization Raw
Using the Tabular Editor, we connect against the XMLA endpoint of our workspace.
Then select the appropriate data model (database).
Via “File > Save as” we now overwrite the database.json file in the “Model” directory of our extracted “Container.pbix” file with the loaded model
Now we compile the container with the integrated data model using pbi-tools.
pbi-tools compile '.Container' '.' PBIT -overwrite
If we now open the compiled PBIT file with Power BI Desktop and perform the file update, we have the data model back in a PBIX file.
That’s it. ?
If your data model uses incremental refresh, you will need to do some editing of database.json before compiling.
You must replace the partitions of type “policyRange” with a partition of type “m” with the corresponding “expression”.
The required “expression” can be found as “sourceExpression” in the corresponding “refreshPloicy” of the query in the database.json file.
Want more cool Power BI content?
Then follow me on LinkedIn and feed your newsfeed with my content:
Marcus Wegener | https://www.linkedin.com/in/marcuswegener/
7 Gedanken zu „Copy Power BI data model back to PBIX file“
You just saved my life! thanks mate
I’m glad I was able to help. How did you find the blog post (Google, LinkedIn, Twitter)?
Not the OP but I found it through Google. Unfortunately I cannot test it out now because I do not have sufficient rights on my machine. It looks good & is exactly what I’m looking for though!
Nice to see you here :-).
We are deploying our changes via ALM toolkit to the dataset in pbi service.
We have deployed a change that consist out of an added table and a relationship. Somehow the local file went missing and we have a previous local version but without the table and relationship. We usually deploying from the pbix to the workspace, but in this matter we want to do it the other way around. ALM detects the difference and it looks like it’s commiting the changes but the pbix file is not updated. Do you know if this scenario is supported? It’s a fully imported model
this scenario is currently not supported.
This is very helpful, thanks. I’ve successfully completed all of these steps except when I try to open the PBIT file it says that it can’t be opened because it is encrypted or corrupted. Any idea what I may be doing wrong?
Hi, I suspect that the data model uses features that are not directly supported by Power BI Desktop, such as multiple partitions.
You are welcome to provide me with the file, then I will have a look at it.
Keep me posted if you have solved the problem so we can all learn from it. 😊
There is now an article by Kurt Buhler that describes the same procedure. This way you can double check the individual steps.