Version Control in Power Bi

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

VERSION CONTROL in Power BI using Power BI Projects and Devops

Version control is essentially a way to track the changes that you have made to your courts when you’re deploying your software simply it is taking snapshots of the code as
you make changes during the development process and it lets the developers to Collab and work on the same code to trace any errors or make changes or revert to the
previous versions etcetera

This entire and the process has been missing in Power BI for the long time.
The file does not support text formatting, so that means when you have opened the Senate text editor and you wanted to update a certain field or measure or add a visual,
you can’t really pinpoint from the text where we want to make the change. That means. We have to save the entire file to make new version.

There is an update in Power BI which allows us to convert or save the Power BI file as. Text or Jason format? This feature is called Power BI project file.
The Power BI Project (*.PBIP) is a recently introduced file format for Power BI Desktop, launched in May 2023 and available for public preview in June 2023. This innovative
format allows users to save their work as a project, featuring a folder structure with individual text files defining report and dataset artifacts. This facilitates the utilization of
source control systems like Git, offering benefits such as change tracking, revision comparison, conflict resolution, and efficient change review. Furthermore, it enables
seamless integration with text editors like Visual Studio Code for enhanced artifact definition editing. PBIP supports CI/CD (continuous integration and continuous delivery),
allowing changes to undergo quality gates before reaching the production system.

This file format differs from regular Power BI Desktop files (PBIX), which store artifacts in a single binary file, posing challenges for integration with source control, text
editors, and CI/CD systems. PBIP aims to address these limitations, providing a more developer-friendly experience for Power BI Desktop users.

Enabling the feature in Power bi desktop

Check on Power BI Project save option.

When a report is saved as PBIP, report and dataset artifact definitions are saved as individual plain text files in a simple, intuitive folder structure.

Storing dataset and report metadata as text files enables capabilities such as:

Source Control: Power BI artifact definitions can be stored in a source control system, typically Git. Allowing developers to track version history, compare different revisions
(diff), and revert to previous versions.
Continuous Integration and Continuous Delivery (CI/CD): Customers can setup systems where developers submit a proposed change to the CI/CD system
Text Editor Support: Allowing developers to use code editors (like Visual Studio Code) for more productive authoring (e.g., batch edits).
Programmatic generation and editing of artifact definitions: Customers can write scripts or applications to make changes to the definition of various artifacts.
In the dataset folder, it contains the report definitions in a text file that can be opened and edited.
when saved as PBIP it creates 4 kinds of files
1) PBIP file 2)Dataset folder 3) Report 4) Gitignore
i)PBIP file : It contains the report for model and authoring.
ii)Dataset folder : A collection of files and folders that represent a Power BI dataset.
.bim is the main file in the dataset folder which conatins all the measures and calculations of the model. which can be modified and those changes are reflected in the
power bi file. The changes which we make in the PBIP file gets stored in dataset folder or report.

iii)Report folder : A collection of files and folders that represent a Power BI report. The most important file is the “report.json”.
iv)GitIgnore : Specifies intentionally untracked files Git should ignore, only metadata should be stored at Git Repo.

Getting started with PowerBI file versioning and co-development with Azure devops

Prerequisites:
i) Power bi file which has been published into service
ii) Github* connection (desktop or Azure Dev ops)
iii)PBIP save as option enabled.
iv)Visual studio code.

* Github lets you to connect to the directories of the files that you have within your local machine. It will let you track changes and finally commit the changes and create a
new version or snapshots of the reports. At the project which were made. We can publish the version so that the others can collaborate on make changes. This also has
ability to revert any of the changes. That we have made to the previous versions. Then publish the reports. With any of the changes that we have made.
Step 1: Save a power bi file as .pbip file and publish to the power bi service account.
Step 2 :Create a Git repo in Azure DevOps.In Azure DevOps, select an existing organization, or create a new one.

1)Create a new Project within the organization:

2)Enter your project details.

3)Click Repos
4)Click the Clone button
5) From the Clone Repository pane, click the Clone in VS Code button and Click the Open button
Cloning Azure DevOps Repos in VS Code

7)Now you get a message on VS Code to Allow an extension to open this URL; click the Open button

Allow an extension to open Azure DevOps Repo URL in VS Code

8)Select a Folder to clone files

9)Click the Select as Repository Destination button


Select a Folder as Repository Destination

Pass your credentials on the Git Credential Manager and click the Sign in button

3) Save the Power BI Desktop file as Power BI Project (PBIP):


The next step is to create a Power BI Project using Power BI Desktop. You can either create a new project from scratch or convert an existing PBIX file into a Power BI
Project file (PBIP).
When we navigate to the location where we saved the project, we will see that the folder contains the following:

The PBIP From Scratch.pbip file

A PBIP From Scratch.Dataset folder

A PBIP From Scratch.Report folder

With this mode, you can save your work as a Power BI Project (PBIP), storing report and dataset definitions in text files. This text-based approach brings several advantages
like Source Control, Continuous Integration and Continuous Delivery (CI/CD), Text Editor Support, Programmatic Artifact Editing.

Once saving the pbix as a PBIP file in the same folder, the Visual Studio Code detects the changes in that folder and displays change notifications as bellow:
4) Make changes on your Power BI Project:

In my case I modified measures/ DAX code then I saved the PBIP file

5) Commit changes detected by Visual Studio:


After modifying the measure, Visual Studio Code detects the changes made
So, we can see that modifying the DAX formula of the measure on the model.bim file

Click the Commit button to commit the changes to Azure DevOps Repo
Type in a comment

Click the Publish Branch button

Publishing Branch in VS Code after Commit

Check Azure DevOps Repo for Changes

Now, we successfully Pushed all changes to the Azure DevOps repo. The next step is to check the DevOps repo. Checking if the changes have gone through on Azure DevOps
is easy. We just need to navigate to the desired Project on Azure DevOps.
In the Azure DevOps interface, Click on "Repos" and then "Commits", to see what you have submitted via Visual Studio.
After making my changes locally and pushing them via Visual Studio Code to Azure DevOps, the changes were automatically reflected in the published report.

Conclusion

Git within Azure DevOps for source control in Power BI projects provides substantial benefits in collaboration, version management, and overall development efficiency.
This seamless integration allows team memebers to collaborate & synchronize changes between Power BI Desktop and the Service.

You might also like