Incremental Backup of PBIX Files - Excelerator BI

Incremental Backup of PBIX Files

I do a lot of Power BI model and report development; maybe you do too. There’s nothing worse than spending an hour or so developing your model only to have something go wrong and you lose your work. Things that can go wrong include:

  • Your PC/App crashes. Power BI does have auto save, but I prefer that to be the last thing I rely on to save the day rather than the only thing.
  • You make a significant mistake in the approach and need to undo your work (autosave won’t save you with this problem).
  • You make a big mistake in Power Query. There is no undo in Power Query, so if you spend an hour inside Power Query, don’t save, and then make a mistake, there is no way to recover your work.

At the time of writing, there are no version control tools built into Power BI, so as a result it is up to you to manage backups yourself.

How to Keep Incremental Backups for Power BI

Simplistically, you can do one (or many) of the following:

  • Close and save your file, then take a backup copy in the same or another folder.
  • Save your files to SharePoint (maybe sync’d to your PC) with version history turned on. That way you should be able to restore previous versions of your work.
  • Save your files on your PC using a OneDrive or Dropbox replica. This is a pretty good approach, but in my experience it doesn’t always work, so again, I like to have this as a last line of defence.

Here is the process/technique I use:

  1. Stop editing for a moment, and hit save from withing Power BI Desktop.
  2. Using File Explorer on your PC, navigate to the folder containing your PBIX file. You should note that the timestamp shows the current time (given it was just saved).
  3. Copy the file to create a new copy (Ctrl-C, Ctrl-V, drag and drop while holding Ctrl, or whatever approach you prefer). A new version of the file will be in the same folder with ” – Copy” appended to the end of the file name (see the original file 1 below, and the copy shown as 2).

  4. The next thing I do is give the file a new name such as the one shown below.

    Note that my naming convention is always “- Copy MMYY HHMM.pbix”. I use this convention because the file name then automatically will sort in date/time order within File Explorer. Of course, you can add the year into the name too if you want, but I have never seen the need.

  5. Sometimes I will give the file name something more meaningful, like is shown below. I do this by exception only when I think I may need to come back to this version at some point in the future.

  6. If you follow this approach, sooner or later, you’re going to have a lot of versions in you folder. For this reason, I like to keep an archive folder. I simply drop the backup versions into this folder.

Don’t Change the Master File Name

Generally speaking I like to keep my master version with the same file name. An alternative approach is to rename the file with different incremental versions, e.g.

  • AW 2020 V1.pbix
  • AW 2020 V2.pbix
  • Etc

This can work, but the biggest issue is if you publish your workbook to If you keep renaming your workbook, you will not be able to easily publish a version update to Power BI assumes when you republish a file with the same name, it is a version update, and when you publish a file with a new name, it is a completely different report.

Power Query Version Control Tips

As I mentioned earlier, there is no undo feature in Power Query as at this writing. You therefore need to take particular care when doing long, complicated editing sessions in PQ. This is a good time to save often. Did you know you can use the same technique I described above WITHOUT exiting Power Query?

When you are ready to save (or about to do something dangerous)

  1. Hit save from within the Power Query Editor.

  2. You will be prompted as shown below. Select Apply Later

Using this approach will save your file even with Power Query still open. Then simply follow the steps from earlier (steps 2 through 6) to create a backup version.

How do you do it?

Well, that’s how I do it. Hopefully it helps some people. If you have another way, I would love to hear how you do it. Let your comments below.

10 thoughts on “Incremental Backup of PBIX Files”

  1. I save the .pbit and Tabular Editor 3 folder structure to a Git repository in DevOps similar to how it’s explained by Data Goblins:

    Saving .pbix files would require a ton of space since I’d be storing gigabytes of the same data over and over and .pbix isn’t a friendly format that supports incremental differences as simple line edits in version control (I can’t see exactly what DAX and M code changes or table/column/relationship definition changes occurred between versions).

  2. Years ago, I wrote a small C# program to create an file in the current folder and copy the file into the zip file with a time string attached to the end of the file name (in the format of “yyyy-MM-dd_HHmm”). Then I use a keyboard shortcut or add it to the right-click menu to quickly archive a copy of a file before I mess with it. Works like a charm.

  3. Hi Matt,

    I do my version control in a very similar way as you describe, but instead, for each version, I create a folder and name it as I want, f.e. REV0001_MyReporX_SomeShortReleaseComment, later I just duplicate the folder. The advantage of this technique is that my PBI files always have the same name inside of the folder, so I do not need to rename them before re-publishing to workspce. Also, sometimes I have some extra small files, which belong to that particular version, so it is nice to have them all in one wrapping folder.

    To duplicate-rename, the folder is equally easy as duplicate/renaming the file.
    One disadvantage of my approach is that if I have additional files, which have not changed, I duplicate them too, and they take up some extra space on the disk unnecessarily, but I accept this disadvantage.

    1. Ooooh, nice trick. I must admit, I was wondering about this (back of my mind) but my approach is pretty fast. I guess benefits include smaller file size. Downside is you need to refresh the data if you roll back.

  4. Good tips as always, Matt.

    As far as Power Query is concerned, I’ve learned (occasionally the hard way) that even just clicking the Advanced Editor and Select All / Copy and then paste the content into OneNote/Notepad before I start hacking away is excellent insurance.

    For some of my more important PQ code, I save the contents of the Advanced Editor in text files that can be version controlled in Git.

    1. Agreed Richard. I still use this approach you mention, particularly when I am dealing with complex changes in a single query. Once you start to touch multiple queries I find that the “save without applying changes” approach works best.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top