- April 26, 2024
- Posted by: mvp1st
- Category: Power Platforms
Visual Studio Code (VS Code) is a tool from Microsoft. It’s a simple but strong editor for writing code. You can use it for many different kinds of work in software development.
If you’re working with Power BI files, which are used for making reports and analyzing data, VS Code can help you compare and combine changes in these files. This is really useful, especially if you’re working with a team. Since Power BI work involves lots of changes and improvements, using VS Code can make it easier for everyone to work together and keep track of changes.
Here are the steps to use VS Code for comparing and merging changes in Power BI files:
Before you start, make sure to make a copy of your original Power BI files. This is important to avoid losing any data accidentally.
Step 1: Convert Power BI Files to JSON Format
Power BI files have a special format (.pbix), which makes it hard to compare them directly. But there’s a tool called “Power BI Sidetools” that can help. It changes these files into a format called JSON, which is easier to compare.
To install PBI Sidetools:
- Go to the PBITools GitHub page and download the installer.
- Unzip the downloaded folders and save them in another folder named Util.
- Create a PowerShell file with some scripts inside. These scripts will help you convert your Power BI files into JSON format.
- After following these steps, you’ll be able to compare your Power BI files using VS Code. It’s a good idea to use a platform like GitHub to manage your code changes. Make sure to run the PowerShell script for both files you want to compare.
Step 2: Comparing Files with VS Code
Now that your Power BI files are in JSON format, you can use VS Code to compare them.
- Open VS Code and go to the Explorer view (press Ctrl + Shift + E).
- Find the folder where you put the Power BI files.
- Right-click on the first file and choose ‘Select for Compare.’
- Right-click on the second file and choose ‘Compare with Selected.’
- VS Code will show both files side by side, pointing out the differences. This helps you see and understand any changes or mistakes.
Step 3: Merging the Changes
- After checking the files, you might want to combine changes from one file into another. VS Code can help with this too.
- Open the comparison view like before.
- Look for the little arrows above and below the scrollbar. Click them to move between changes.
- Use the “Accept Change” button to copy changes from the left file to the right one.
Step 4: Converting JSON Files Back to Power BI Files
- Once you’re done merging, change the JSON files back to .pbix format. You can do this with PBI Sidetools.
- Make a PowerShell file with the code below.
- Change the file paths to match your computer.
- If your Power BI file has a dataset, make a .pbit file first, then save it as a .pbix file.
- This will make a new Power BI file with all the changes.
Ready to Begin?
Using Visual Studio like this gives you more control and makes it easier to work on big projects with others in Power BI. If you need help with this, ask a Power BI expert today.