Day #7 – Disk Usage Dashboard
As part of my Power BI 12 Days of Dashboards series, day 7 brings you a new way to look at the old problem of disk space usage.
I recently used Power BI in one of my enterprise customer environments to help visualize disk usage on the shared storage SAN. With a simple PowerShell script, we were able to export a .csv file containing file name, extension, size, and last accessed date of all files stored on the SAN and use this as input into a simple dashboard in Power BI. In this environment, we discovered that there were files on the SAN that hadn’t been accessed since the late 1990’s. As a result, this dashboard became very helpful in creating and enforcing rules around data storage and helped teams identify targets for cleanup to save on storage space.
Here are a few examples showing different folder contents to give an idea of the dashboard usage.
1. File usage within the folder I’ve created for this blog series. As you can see, everything has been accessed recently, and the files are all extensions that you’d expect as part of a Power BI project (.csv, .xlsx, .pbix, .pbit, etc.)
2. File usage within a folder structure I use for photo storage. As you can see in this one, it is extremely high in .jpg files, but also has many files that haven’t been accessed since 2009.
The first step to creating this simple dashboard is to use PowerShell to build your filelist.csv file.
- Run the following PowerShell script from the PowerShell ISE from the desired folder path (ex: c:\pictures):
Get-ChildItem -File -Recurse | Select-Object basename,extension,length,lastaccesstime | Export-Csv filelist.csv -NoTypeInformation
- This creates the .csv file (filelist.csv) that is used as the input for this Power BI Dashboard.
Next, download the Power BI Template from here and continue with the following steps:
- Download and open the attached DiskUsageTemplate.pbit file and open it in Power BI Desktop
- A popup box appears asking for the full path of the .csv file created in the above steps. Provide the full path to the .csv file on your computer and click the “Load” button in the bottom right. (TIP: Make sure the .csv file is closed or you’ll hit an error here. If so, close the file and relaunch the Power BI template)
Sam Lester (MSFT)