top of page

How to Use Visual Studio Code to Compare and Merge Changes in Power BI Files

Manage version control and simplify the user experience with Visual Studio Code in Power BI.

visual studio code

Visual Studio Code (VS Code), Microsoft's lightweight but powerful source code editor, is a versatile tool for a wide range of development tasks. Using Visual Studio Code for comparing and merging changes in Power BI files is a powerful way to manage version control, particularly when working in teams. Given the iterative nature of data modeling and report design in Power BI, this capability can streamline collaboration and version control, particularly in teams. Explained below are the steps for using VS Code to compare and merge changes in Power BI files.

*** Before getting started, remember to backup your original Power BI files before attempting these procedures to prevent inadvertent data loss.

Step 1: Convert Power BI Files to JSON Format

Power BI files (.pbix) are essentially compressed archives, making direct comparison difficult. However, a tool called "Power BI Sidetools" can help convert these files into JSON format, enabling easy comparisons.

To install PBI Sidetools:

  1. Download the installer from the PBITools GitHub page (Welcome to pbi-tools | pbi-tools).

b. Download these:,

2. Decompress the folders and save them in another folder called Util (this is for the PowerShell scripts to work).

3. Create a PowerShell file with the following PowerShell scripts updated to match your folder structure.

Parse Power BI (.pbix) file PowerShell

I recommend using GitHub or some other repository to modify your code. You will want to update the name of the file and the folder path to what is on your device. Once the code above has ran, you will have a new folder that contains the JSON files that make up a .pbix file.

Run this PowerShell script for both files you want to compare.

Step 2: Comparing Files with VS Code

With the Power BI files now in JSON format, you can use VS Code to compare them.

  1. Open VS Code and navigate to the Explorer view (Ctrl + Shift + E).

  2. Open the folder where you decompressed the Power BI files.

  3. Right-click on the first file and select 'Select for Compare.'

  4. Right-click on the second file and select 'Compare with Selected.'

VS Code will display the two files side by side, highlighting the differences between them. This allows you to visually compare and analyze changes or discrepancies.

Step 3: Merge the Changes

After comparing the files, you might want to merge changes from one file to another. VS Code has in-built features that support this.

  1. Open the comparison view as described in the previous step.

  2. Look for the inline "change navigation" icons above and below the scrollbar.

  3. Click on these icons to move between changes.

  4. Use the "Accept Change" button (which appears when hovering over a change) to accept changes from the source (left) file to the destination (right) file.

Step 4: Convert JSON Files Back to Power BI Files

After merging changes, you'll want to convert the JSON files back to the .pbix format. PBI Sidetools can help with this.

  1. Create a PowerShell file with the code below.

  2. Update the file paths to match your device/repository.

  3. If your Power BI file has a dataset you will need to create a .pbit file and then you can open and save it as a .pbix file

Build PBIX file PowerShell

This will create a new Power BI file incorporating the merged changes.

Ready to Get Started?

Using the Visual Studio method brings added control, transparency, and flexibility for working on complex or collaborative projects in Power BI. For help unlocking these benefits, contact a Power BI specialist today.

Article By Nathan Giullian, Business Intelligence Developer at JourneyTEAM

nathan giullian at JourneyTEAM


Commenting has been turned off.
bottom of page