Power BI 12 Days of Dashboards – Day 7 – Disk Usage Dashboard


Power BI Dashboard Disk Space Usage

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.)

Disk Space Usage Dashboard

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.

Disk Space Usage Dashboard

 

The first step to creating this simple dashboard is to use PowerShell to build your filelist.csv file.

  1. 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
  2. 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:

  1. Download and open the attached DiskUsageTemplate.pbit file and open it in Power BI Desktop
  2. 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)

Thanks,
Sam Lester (MSFT)

Comments (3)

  1. Amit BK says:

    Hi Samuel,
    great project 🙂

    you can use the this M code (on PBI desktop->Edit Queries) instead of the CSV file.

    P.S I have added the file names as details to the TreeMap

    let
    Source = Folder.Files("C:\Users\XXX\Pictures"),
    #"Removed Columns" = Table.RemoveColumns(Source,{"Content", "Date modified", "Date created"}),
    #"Expanded Attributes" = Table.ExpandRecordColumn(#"Removed Columns", "Attributes", {"Size"}, {"Size"}),
    #"Renamed Columns" = Table.RenameColumns(#"Expanded Attributes",{{"Size", "Size (b)"}, {"Date accessed", "lastaccesstime"},{"Folder Path", "BaseName"}})
    in
    #"Renamed Columns"

  2. jmdh says:

    For non PowerShell users, file data can be obtained using the Folder option of Get Data in PowerBI desktop

    (just realised a similar comment has been posted)

  3. frederic Simons says:

    Note for those who are note using the US format of date. You will get errors at the loading phase. You can correct this by changing the regionnal settings of the current file (in the menu option)

Skip to main content