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:
- Stop editing for a moment, and hit save from withing Power BI Desktop.
- 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).
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).
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.
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.
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
This can work, but the biggest issue is if you publish your workbook to PowerBI.com. If you keep renaming your workbook, you will not be able to easily publish a version update to PowerBI.com. 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)
Hit save from within the Power Query Editor.
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.