Are a developer? Do you work with Power BI? Then you know that there are some challenges with dashboard versioning.
Up until now, your only option was to just keep backup copies of your PBIX file. This works for the most part. But lacks some key features we developers usually look for.
With the release of the June 2023 update, we now have access to PBIP files. These are "Power BI Project" files that you can create via Save As -> PBIP (similar to how you would create a template PBIT file). For nerdy details, see the Microsoft documentation here.
Using PBIP files
Be sure to enable it from the Preview features:
Then you can choose the type from Save As:
Then the following folders and files will be created:
What's the benefit?
The great thing about this is that all files can be opened in a text editor like Notepad, and most of them are JSON structured files. This allows us to modify parts of the Power BI file without actually opening the Power BI file. This is great news for those of us that work with particularly large PBI files that tend to take a long time to boot up.
For example, you can open the tabular model (model.bim) to access measures, tables, and power query scripts.
If you are a programmer, then your coding alarm bells must be going off. In fact, most of the same principles I show in my three part Power BI Automation with Python series can be applied using these files. Actually, using these pbip files should be used with automation because we do not need to "jail break" Power BI by converting it to a zip, then extracting it (this can cause corruption if you are not careful). Perhaps in a later post I will discuss the differences between the two methods.
There are two files of particular interest; report.json and model.bim. The report.json file contains information about all the visuals on the dashboard like position, size, measures used, etc.
Unfortunately, Microsoft doesn't support editing this file while PBIP is in preview. However, we can still open and edit it if we know what we are doing (again, refer to my automation article above if you are interested in that). The model.bim file contains the tabular model and power query scripts. Microsoft has blessed this one as okay to edit, if you know what you are doing.
You can have multiple report.json and model.bim files within the same folder - as long as they are named differently. For example, you can have different versions of the report file like this:
Power BI will always use the "report.json" file when it loads up. So when your newest version of the report is ready, you can simply overwrite this file with it. The same is true for the model.bim file.
What exactly is a pbip file?
This too is a JSON file. Open it up and you'll see it's actually a very small file with only a few key value pairs.
"path": "Power BI Projects.Report"
The "path" key value can be modified to a different folder location and it'll work as long as the folder it points to has the required files and folder.
It's worth noting that there is also a definition.pbir file within the reports folder. This is also a JSON file that looks very similar to the pbip file, in that it also has a "path" key value. This time, it points to the dataset.
"path": "../Power BI Projects.Dataset"
So, there's a sort of lineage going on here. Like this:
yourdashboard.pbip -> Report Folder -> definition.pbir -> Dataset Folder
I'm sure you can imagine, this opens up a variety of ways you can go about your versioning needs!
The Alien says: Opening the definition.pbir file with Power BI (not a text editor) will open your dashboard normally, as if you opened the pbip file with Power BI.
As it's still in preview, there are some quirky things you may experience. If any of your column or measure names have spaces before or after, you won't be able to open the pbip file and you'll get the following error: "Unable to open document. Unsupported Column name has been found in data model schema."
To resolve, you need to go into the the report.json and model.bim files and remove the spaces. Depending on the complexity of your dashboard, you may be able to do a simple find and replace. But more than likely, you'll need to be very precise in this action.
For example, if you are trying to replace a measure named " Sales Amount" with "Sales Amount" (removing the space at the beginning), and you also have a measure called "Average Sales Amount", a find and replace would erroneously change the average measure to "AverageSales Amount".
This has been an introduction to the PBIP files. Cheers!