In the second part of my blog post I am going to detail how to use the version control with Power BI Desktop files.

This will include adding files, checking files in and out, viewing previous versions and reverting to previous versions.

If this is the first time you are reading this blog post, I would highly suggest reading Setting up Version Control for my Power BI Desktop Files (PBIX) with no additional Cost * | Part 1

Adding files into Version Control

In the steps below I will show you how I add files into Version control.

The best advice that I can give and the way that I have worked with Azure DevOps and version control in the past is to always save your file directly to the local path where you have your Azure DevOps configured.

  • In my working example I have my local path set here:
  • I create or open my Power BI Desktop file (PBIX).
  • I then save it to the following location
  • I opened Visual Studio 2019
  • I then navigated to the Source Control Explorer
    • If the Source Control Explorer did not open up, I can find it here.
    • I clicked on Team Explorer.
    • Then selected Source Control Explorer
  • When opening it up, I could not initially see my file Strava.pbix this is fine because I have not added the folder to Source Control.
  • I then right clicked on Data Analytics and selected “Add Items to Folder…”
  • I then made sure to select the folder where my PBIX file is saved.
    • NOTE: The reason I did this is because I wanted to include all folders and files within my Data Analytics Folder
    • I then clicked Next
  • I could then see all the items that are going to be added.
  • As with my example there currently is only 1 file
    • I then clicked Finish
  • I then browsed to my folder in the Source Control Explorer and I can see my file under the Power BI PBIX folder
  • Next to the PBIX there is a plus sign in green next to the name
    • This shows me that there is a file that needs to be added to Source Control.
  • I then right clicked on the file and selected Check In Pending Changes
  • On the right-hand side, the window changes to Pending Changes.
    • I then put in a comment (Because in part 1, I changed the settings that there must be a comment)
    • I then clicked on Check In
  • I then got the window for Check-in Confirmation
    • I put in the tick to “Don’t prompt again”
    • And then clicked Yes
  • I then got confirmation that my file has been checked in with the Changeset number
  • I can also see that it has been checked in if I have a look at the file in the Source Control Explorer

Checking In Changes to a file

Next is if I made to a PBIX and I wanted to check in the changes

  • I did some work on my existing PBIX and I saved the changes in Power BI Desktop, which I now want to check in.
  • I then go back to my Source Control Explorer (You might have to open Visual Studio if you closed it down)
  • I can then see that I now have a red tick next to my file name
    • The red tick means that there have been changes to the file.
  • I follow the same process as described before where I now right click and select Check In Pending Changes
  • On the right-hand side, the window changes to Pending Changes.
    • I then put in a comment, or multiple lines of comments.
    • I then clicked on Check In
  • I then got confirmation that my file has been checked in with the Changeset number
  • I can also see that it has been checked in if I have a look at the file in the Source Control Explorer

Viewing Previous Versions

If I wanted to review a previous version, I would do it by completing the following steps

  • I right click on my file Strava.pbix in the Source Control Explorer and select View History
  • I can then see all the previous versions that have been checked in as well as the comments.

Viewing a Previous Version of the PBIX

I have often made changes in the past, which I had checked in. The challenge is that even though I put in comment I was not 100% sure that it was the version that I wanted.

Fortunately, you can view the previous version of the PBIX.

  • I would right click on my file Strava.pbix in the Source Control Explorer and select View History
  • I could then see all the previous versions
  • I then right clicked on the previous version, in my example is changeset 7 and selected View
  • This then opened the PBIX in Power BI Desktop.
  • I could see by the filename that it was the version that I had checked in
    • As well as it correctly had the file contents when I checked it in.
  • Now I could either save this file elsewhere, make changes or overwrite the existing file.

Reverting to a Previous Version

If I had a situation where I had made a change and I wanted to roll back to the previous version, I would complete it with the following steps.

  • The first step is I would have to make sure that my PBIX file is not open in Power BI Desktop.
  • I would right click on my file Strava.pbix in the Source Control Explorer and select View History
  • I could then see all the previous versions
  • If I wanted to revert to Changeset 6 with the associated comment I would right click on 6 and select Get This Version
  • The one thing to note is after clicking Get This Version I do not get a prompt to say it has been replaced.
  • I could see that it was replaced in the Output window as shown below.
  • I could then go and open my PBIX in Power BI Desktop and it will be the version which I just replaced.
  • The great thing with version control is if I reverted to a previous version, and it was still wrong, I could complete the steps again and go to an older or newer version. Which can be something of a challenge when there is no version control.

Adding additional PBIX files to Version Control

The final step is when you want to add additional PBIX files to version control.

  • I open Visual Studio, then navigate to my folder where I have got my PBIX files.
    • As previously mentioned, I have all my PBIX files stored under a main folder with sub folders.
  • I then right clicked on Data Analytics and selected “Add Items to Folder…”
  • I then made sure to select the folder where my PBIX file is saved.
    • NOTE: The reason I did this is because I wanted to include all folders and files within my Data Analytics Folder
    • I then clicked Next
  • I could then see all the items that are going to be added.
  • I then browsed to my folder in the Source Control Explorer and I can see my file under the Power BI PBIX folder
  • Next to the PBIX there is a plus sign in green next to the name
    • This shows me that there is a file that needs to be added to Source Control.
  • I then right clicked on the file and selected Check In Pending Changes
  • On the right-hand side, the window changes to Pending Changes.
    • I then put in a comment (Because in part 1, I changed the settings that there must be a comment)
    • I then clicked on Check In
  • I then got confirmation that my file has been checked in with the Changeset number
  • I can also see that it has been checked in if I have a look at the file in the Source Control Explorer

Conclusion

In part 2, I have shown you how to get files into version control, check in, check out, view previous versions as well as revert to previous versions.

I do think that it is vital to have version control in place when you are making a lot of changes over a day and you do not want to lose any of the hard work that has been done. Or if you want to view another version of the file to see if there is anything that could have caused it to break.

Thanks for reading, any comments or suggestions are most welcome.