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.
required tools:
- 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. ?
BONUS:

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/
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!
Hi Marcus
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
Best regards
Khoi
Hi Khoi,
this scenario is currently not supported.
https://github.com/microsoft/Analysis-Services/issues/89
Best regards
Marcus
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.
https://data-goblins.com/power-bi/download-pbix
Any thoughts on how to accommodate error „The QueryDependencyGraph should not be null for a V3 model“ ?
I am trying to convert old SSAS models, built around 2020 on SSAS 2016, and I keep getting this error when I use the method above, no matter how I tinker with the settings it will not open.
SSAS Compatibility is 1200
Hi Be,
Kurt writes in his blog that there are differences in the .bim file for the different AS models.
————————————————
https://data-goblins.com/power-bi/download-pbix
? Limitation 1: Doesn’t work with AAS datasets
The .bim file from an AAS dataset is not using the Power BI format. For example, the Model.DataSources Property does not exist in the Power BI metadata.
If the AAS .bim and Power BI dataset .bim were the same, migration would be simple ?
————————————————
I would create a simple data model with Power BI and use it as a reference for customizations.
Marc, I have tried to follow the method and everything looks fine. I only bump in the problem that PowerBI keeps saying I have pending changes in my queries. Any idea how to fix this?
Hi Alexander, sorry for the late reply, but unfortunately I have no idea what the problem could be either.