If like your C drive was running out of space and you decided to free up some space you may have realized that Power BI desktop was using a lot of your disk space.
In this short post, we will see why Power BI desktop is consuming a lot of disk space and how we can safely reduce it.
Table of Contents
Analyze disk space usage
There are multiple ways to analyze the disk usage space, we can use the built-in windows tool but I by far prefer more advanced tools like WinDirStat or TreeSize Free.
Whatever tool you’re using to analyze the usage of your disk space don’t forget that some files will not show up unless you run the app as Administrator and of course always be cautious before deleting files from your PC.
Let’s analyze the disk space used by Power BI Desktop
As we can see from the below scan Power BI desktop is using 13.4Gb of my disk. Actually, 13.4GB is not that much and that is because I did some cleansing a few weeks ago and before that cleaning-up, my Power BI desktop was using around 150GB.
Why Power BI is using all that space
Now let’s see why Power BI is using all that disk space. As we can see I did not scan the install folder of Power BI desktop which is usually installed in “program files…” but instead I scanned the directory “C:\Users\yourUser\AppData\Local\Microsoft\Power BI Desktop”
AppData is a hidden folder that contains custom settings and other information needed by applications. So in theory we should not modify or remove the files in that folder as there’s a risk of breaking something or affecting the smooth functioning of the Apps installed on the machine.
But if we know what we’re doing this is pretty safe so now let’s see what files we can safely delete and see what will be the impact of removing these files.
As the name implies TempSaves keeps copies of your Power BI Report when you close your report without saving it.
So when we work with large files (reports with imported data) and Power BI gets closed accidentally a copy of the open reports will be saved in the TempSaves folder. And this happened quite often actually, windows updates, Power BI stops responding or when we forgot to plug our laptop, etc.
In Power BI we can change the auto recovery settings to prevent Power BI from always saving copies of our reports but I’d strongly suggest keeping the auto recovery on, it saved my days many times!
As we see in the below scan Power BI can save multiple copies of the same report so when a report file is large the space used can quickly add up and become an issue for disk space usage.
So what can we do about it?
Well, to me the best solution is to run a disk scan from time to time and check for the files in the TempSaves folder that can be safely removed.
There’s also another folder “AutoRecovery” which stores the las auto recovered files but it is usually empty as whenever we open Power BI there’s a prompt message asking if we want to keep or remove auto-recovery files so Power BI does the cleansing for us in that folder.
Alternatively, we could create a power shell script to clear all files older than a specific date but seems more like an overkill to me…
Clear the Cache
As we saw above the majority of the disk space used by Power BI is the copies of reports that we should clean from time to time.
Well for the cache this is about the same, there are three types of cache that Power BI will store in the AppData folder.
The good thing about the cache files is that you don’t need to access the AppData folder to do the cleansing since you can control the maximum size and the clearing directly from Power BI.
The only disadvantage of clearing the cache directly from Power BI is that we cannot decide to keep the recent cache and get rid of the old cache files only. So if we want to manually clean the files (which I never do) we can still do it.
Here are the folders associated with each cache:
– Data Cache Management: “C:\Users\xxx\AppData\Local\Microsoft\Power BI Desktop”
– Q&Q Cache: “C:\Users\xxx\AppData\Local\Microsoft\Power BI Desktop\Lucia Cache”
– Folded Artifacts Cache: “C:\Users\xx\AppData\Local\Microsoft\Power BI Desktop\FoldedArtifactsCache”
Also just to avoid any confusion I want to add that these 3 cache options are not related to the Vertipaq engine cache or the report cache. If you want to find out more about the report cache and the Vertipaq cache you can check the youtube video of Marco The Tale of Two Caches
The Data Cache management is used for Power Query: (Always keep 32MB at least to make sure that PBI can preview the first 100 rows).
The Folded Artifacts Cache is used to improve the performance of direct queries (if it folds…)
And Q&A cache speaks for itself and so far I never met someone using it anyway well except for a demo.
As we saw in this post Power BI is not supposed to take much of our disk space since we can control how much cache we want to allocate and easily clear it from Power BI directly.
However, even if the auto-recovery is a great feature that I encourage you to always keep on, there’s no possibility to clear the auto-recovered files from PBI directly, so it has to be done manually from time to time.