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/