Introduction to Microsoft Power BI Developer Mode

Until recently, managing versions and sources of Power BI files has been a cumbersome task. Without a built-in version control system, Power BI users have faced challenges such as:

  • Manual File Backup: Users create multiple copies of PBIX files, making tracking changes and reverting to previous versions difficult in a fragmented file management system.
  • Collaboration Challenges: Team members working simultaneously on Power BI projects face complex merging of changes without structured version control, leading to data inconsistencies and loss of work.
  • Lack of Change Tracking: Tracing and analysing changes in Power BI files becomes challenging without proper version control, hindering audit trails and understanding report evolution.
  • Deployment and Rollback Difficulties: The absence of version control causes manual and error-prone deployment of Power BI files, risking the deployment of incorrect or unfinished reports and compromising decision-making and data accuracy.

However, with the introduction of the new Power BI Developer Mode focused on source controlling Power BI files, these challenges are being addressed. This new capability brings a structured and efficient approach to version control, enabling Power BI users to effectively manage changes, collaborate seamlessly, track modifications, and deploy reports with confidence. In this blog, we will explore this exciting new feature.

What is ‘Power BI Developer Mode’

Even though it says so, Power BI Developer Mode is not really a mode. Or at least not yet, but this might change in future. In reality, it allows you to save any PBIX file as PBIP (Power BI Project). When saved as PBIP, the report and the dataset are saved as individual plain text files, into a folder structure. This is what the folder structure looks like:

  • The PBIP file contains a pointer to the report folder. When you open it, it opens the report and the model inside Power BI Desktop.
  • The report folder contains the following files and folders, that represent a Power BI report:
    • .pbi/localSettings.json contains report settings that apply only for the current user and local computer. It should be included in gitIgnore or other source control exclusions. This file is ignored by default;
    • json contains data model diagrams describing the structure of the dataset associated with the report;
    • pbir contains the overall definition of a report and core settings. This file also holds the reference to the dataset used by the report. Power BI Desktop can open a .pbir file directly, just the same as if the report were opened from a .pbip file. Opening a .pbir also opens the dataset alongside if there’s a relative reference using byPath;
    • json defines a report including visuals, page layout, and intended interactions;
    • Other files inside the report folder are item.config.json and item.metadata.json, which helps to identify the folder as a source control representation of a service item and contains item attributes.
  • The dataset folder contains the following files and folders that represent a Power BI dataset:
    • .pbi\localSettings.json contains dataset settings that apply only for the current user and computer. It should be included in gitIgnore or other source control exclusions;
    • .pbi\editorSettings.json contains dataset editor settings saved as part of the dataset definition for use across users and environments;
    • .pbi\cache.abf An Analysis Services Backup (ABF) file containing a local cached copy of the model and data when it was last edited. It should be included in gitIgnore. Power BI Desktop can open a project without a cache.abf file. In that case, it opens the report connected to a model with its entire definition but without data. If a cache.abf exists, Power BI Desktop loads the data and overwrites the model definition with the content in model.bim;
    • .pbi\unappliedChanges.json Power BI Desktop allows you to save changes made in the Transform Data editor (Power Query) without first applying those changes to the data model.

When you select Apply later, the unapplied changes are saved into the unappliedChanges.json file. When pending changes are in the unappliedChanges file, Power BI Desktop prompts you to apply or discard those pending changes:

If you select Apply changes, Power BI Desktop overwrites the queries in model.bim with the queries from unappliedChanges.json. If you have edited queries in model.bim outside of Power BI Desktop, your changes are lost and replaced by the queries in unappliedChanges.json when those changes get applied:

  • model.bim contains a Tabular Model Scripting Language (TMSL) Database object definition of the project model;
  • definition.pbidataset contains the overall definition of a dataset and core settings;
  • json contains diagram metadata that defines the structure of the dataset associated with the report;
  • config.json identifies the folder as a source control representation of a service item;
  • metadata.json contains attributes that define the item.

By storing the dataset and the report as individual text files, it allows us to:

  • Use Power BI Desktop to author report and dataset files in format that can be stored in source control;
  • Allow for collaboration, source control integration, version history tracking, comparison of different revisions and reverting to previous versions;
  • Build CI/CD workflows to enforce quality gates prior to reaching production environments;
  • Enable code reviews, automated testing, and automated build to validate the integrity of a deployment.

How to enable Power BI Developer Mode?

This feature is still in preview, so to enable it, you need to go to File > Options and settings > Options > Preview features and tick the ‘Power BI Project (.pbip)’ save option box.

How to save to Power BI project file?

To utilise the new Developer Mode, all you need to do is to click ‘Save as’ once you are done with your Power BI development and choose to save the file as .pbip file from the ‘Save as type’ drop down menu.

How to open a Power BI Project?

You can open a Power BI project in two ways:

1. Use the .pbip file in the root of the project folder

2. Inside the .Report folder, open the .pbir file.

How to work with the project?

You can edit the files in Visual Studio Code or any code editor of your choice, as you would do with any other json file. If you choose Visual Studio Code, you will also get additional features like validation and IntelliSense suggestions.

If you have any questions related to this post please Get in touch and speak to a member of the Adatis team to discuss the topic in greater detail.