Ravindra BagaleCourses & study guides Track your progress

Labs · Power BI

Lab: Combine Three Monthly Bank-Statement CSVs from a Folder and Refresh When a Fourth Month Arrives

Beginner30 minPower BI Desktop (free) · bank_statements_jan_mar.zip · bank_2026_04.csv

Course: Power BI · Chapter 9: Get Data from Folder: Monthly Bank Statements Walkthrough

Chapter 9 walks through Get data from Folder; this lab does it with your own sample statements and a fourth month.

Download bank_statements_jan_mar.zip (Jan–Mar, 3 CSVs) Download bank_2026_04.csv (April, add later)

Chala mitrano! Every month a new statement, every month the same copy-paste into one big sheet. Boring, and one wrong paste spoils everything. Today Power BI does the copy-paste for us: we point it at a folder once, and every new file in that folder joins the report on Refresh. Folder madhe taka, refresh dabaa, kaam khatam!

Suppose we are…

Suppose we are a young software engineer at Infosys in Pune who wants to track monthly spending. Our bank (for example HDFC or SBI) lets us download each month's statement as a CSV. We have January, February and March 2026. April's file will come next month, and we do not want to rebuild anything when it does.

The statements are sample data made up for practice: a salary credit, rent, a Swiggy order, the MSEDCL electricity bill, an Amazon purchase and a mutual fund SIP each month. No real account details are used.

Goal of this lab

By the end you will have:

  • One table Bank with 18 rows from 3 files, plus a Source.Name column telling which file each row came from.
  • A measure Total Debit by month: 28,089, 28,236 and 28,383.
  • Added April by copying one file into the folder and clicking Refresh: 24 rows, Total Debit 113,238.

What you need (all free)

The data: before and after

Before. Three separate files of 6 rows each in one folder.

Before: three files bank_2026_01, 02 and 03 with 6 rows each and total debits 28,089, 28,236 and 28,383; total 84,708

After. One combined table. When April is dropped into the folder, one Refresh adds it.

After: one combined table with Source.Name for four files; April row highlighted; 24 rows and total debit 113,238

The formula

When you click Combine & Transform, Power Query writes these main steps for you:

Source                  = Folder.Files("C:\PowerBI\BankStatements")
Filtered Hidden Files1  = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true)
Invoke Custom Function1 = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content]))
Expanded Table Column1  = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", …)

In plain words:

  1. Folder.Files makes a list of every file in the folder, one row per file.
  2. Transform File is a small function built from the first file. It reads one CSV and promotes its headers.
  3. The function runs on every file, and Expand stacks the results under each other.

So when April arrives, Folder.Files simply finds 4 files instead of 3. Nothing else changes.

And the one DAX line:

Total Debit = SUM ( Bank[Debit] )

Steps

  1. Create the folder C:\PowerBI. Right-click bank_statements_jan_mar.zip → Extract All…, set the destination to C:\PowerBI and click Extract. Leave bank_2026_04.csv in Downloads for now.

    What you should see: C:\PowerBI\BankStatements with three files: bank_2026_01.csv, bank_2026_02.csv, bank_2026_03.csv.

  2. In Power BI Desktop: Home → Get data → More… → Folder → Connect. Browse to C:\PowerBI\BankStatements and click OK.

    What you should see: a window listing the 3 files with columns such as Name, Extension and Date modified.

  3. Click Combine & Transform Data. In the Combine Files window keep Sample File: First file and check Delimiter: Comma. Click OK.

    What you should see: a query called BankStatements with columns Source.Name, Date, Description, Debit, Credit, Balance and 18 rows. On the left there is a new group, Transform File from BankStatements, with helper queries. Do not delete them.

  4. Check the types. Date must have the calendar icon; Debit, Credit and Balance must show 123. If any is ABC, click the icon and choose Whole Number.

    What you should see: empty Debit or Credit cells show null, for example the Credit of the Rent rows.

  5. Rename the query to Bank (right-click → Rename) and click Home → Close & Apply.

  6. Right-click Bank in the Data pane → New measure: Total Debit = SUM ( Bank[Debit] ).
  7. Make a Table visual with Source.Name and Total Debit.

    What you should see: bank_2026_01.csv 28,089, bank_2026_02.csv 28,236, bank_2026_03.csv 28,383, Total 84,708.

  8. Save as Lab-09-bank-folder. Now April arrives: copy bank_2026_04.csv from Downloads into C:\PowerBI\BankStatements.

  9. In Power BI, click Home → Refresh.

    What you should see: a fourth row, bank_2026_04.csv 28,530, and Total 113,238. Table view shows Bank (24 rows). You added no step.

  10. Add a Card with Total Debit and a Slicer with Description. Click Swiggy - UPI.

    What you should see: the card shows 2,782 (640 + 677 + 714 + 751): Swiggy spending went up every month.

  11. Save again.

Ravindra Bagale's Tip

Keep the folder clean. Only same-shaped CSVs in it: no Excel copies, no PDFs, no "final_v2" files. One wrong file and the refresh fails or adds strange rows. Many teams make a rule: one folder, one file type, one format. Folder swachh, report swachh!

Common mistakes

Mistake What happens Fix
Choosing the zip file itself in Get data Power BI cannot combine a zip Extract it first, then point at the folder
Extracting to C:\PowerBI\BankStatements You get BankStatements\BankStatements\… Extract to C:\PowerBI; the zip already has the BankStatements folder
Deleting the helper queries Refresh fails: "Transform File wasn't recognized" Keep the Transform File from… group
Putting a PDF or Excel file in the folder Refresh error or junk rows In the Source step, filter Extension to .csv
Clicking Combine & Load and forgetting to check types Debit may load as text and cannot be summed Use Combine & Transform and check the 123 icons
Renaming April to bank_april.csv It still loads, but the names no longer sort by month Keep one naming pattern: bank_YYYY_MM.csv

Self-check checklist

0 of 5 done

Try-at-home challenge

Source.Name is ugly in a chart. Make a proper Month column instead and show Total Debit by month in a column chart. Hint: in Power Query, select the Date column and use Add Column → Date → Month → Name of Month.

Check your answer

The new column shows January, February, March, April. In the chart, sort it by month order, not A–Z: add another column with Add Column → Date → Month → Month (1 to 4), then in Table view select the Month name column and use Column tools → Sort by column → Month (the number column). The columns read 28,089, 28,236, 28,383 and 28,530: spending creeps up by about 147 every month, mostly from Swiggy and electricity.

Samjla ka? Folder.Files lists the files, Transform File cleans one, Expand stacks them all, and Refresh picks up new months. Aata pudhe jaauya: turn a hard-coded file path into a parameter.