Copy Power BI data model back to PBIX file

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.

This file can't be downloaded yet. You can't download this file right now because it's been modified using an XMLA endpoint.

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:

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”.

Power BI Desktop save empty PBIX file

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
pbi-tools extract

Using the Tabular Editor, we connect against the XMLA endpoint of our workspace.

Tabular Editor XMLA-Endpunkt

Then select the appropriate data model (database).

Tabular Editor database selection

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

Tabular Editor Save data model as dabase.json

Now we compile the container with the integrated data model using pbi-tools.

pbi-tools compile '.Container' '.' PBIT -overwrite
pbi-tools compile

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:

This file can't be downloaded yet
You can't download this file right now because it uses incremental refresh.

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”.

Visual Studio Code: Partitionen in database.json

The required “expression” can be found as “sourceExpression” in the corresponding “refreshPloicy” of the query in the database.json file.

Visual Studio Code: "sourceExpression" in the corresponding "refreshPloicy" of the query

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/

Veröffentlicht von

Marcus Wegener

Marcus Wegener

Marcus Wegener ist Anwendungsentwickler für Business Intelligence und erstellt Lösungen, mit denen sich große Datenmengen schnell analysieren lassen. Kunden nutzen seine Lösungen, um die Vergangenheit zu analysieren, die Gegenwart zu steuern und die Zukunft zu planen, um damit mehr Erfolg zu generieren. Dabei ist seine einzigartige Kombination aus Wissen und Auffassungsgabe ein Garant für ihren Erfolg.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

I accept that my given data and my IP address is sent to a server in the USA only for the purpose of spam prevention through the Akismet program.More information on Akismet and GDPR.