Digital Salla

Financial Data Analysis (Excel & BI): PivotTables, Power Query and Power BI

Audit, Governance & Digital Transformation

Design titled "Financial Data Analysis (Excel & BI): PivotTables, Power Query and Power BI", showing a DAX measures card (revenue 10,000, expenses 7,000, net profit 3,000, net margin 30%), a star schema (Fact_GL in the centre with Dim_Date, Dim_Account and Dim_Branch), and a "PivotTables: the four areas" card (filters, columns, rows and values with examples).

Financial data analysis turns raw accounting data (entries, invoices, bank statements, receivables, inventory) into answers to decision questions: why did expenses rise? Where are margins eroding? Which customers pay slowest? Three Microsoft tools work together: Power Query prepares data in refreshable steps, PivotTables in Excel summarise it, and Power BI holds a data model with shared measures for reports and dashboards.

From decision question to action: six steps

Start with the question, not the tool; without one, tables pile up with no effect. Then work in order:

  1. Decision question: what do we want to improve — cost, collection, inventory or margins?
  2. Extract data from one agreed source.
  3. Clean and govern: standardise master data and definitions.
  4. Model and analyse: PivotTables or a Power BI model.
  5. Present: a report or dashboard with clearly defined measures.
  6. Decide and act: an owner, a deadline and follow-up of variances.

Skills follow the same order: accounting data structure and the chart of accounts, data quality, Excel functions and PivotTables, Power Query, then Power BI.

Data sources and preparation

SourceExamplesPractical note
Accounting system or ERPGeneral ledger, receivables and payables, inventory, fixed assetsThe best source when entries are disciplined
BanksStatements, receipts and paymentsTo verify cash flows and reconcile
Sales and billingInvoices, returns, discountsInvoice timing can differ from the revenue recorded
PurchasingPurchase orders, supplier invoicesThe basis of spend analysis
Internal Excel filesTrackers and operating filesFlexible, but need access controls and documentation

The rule: if master data (customers, suppliers, items, cost centres) is not governed, no dashboard will save you. Decide who creates, approves and edits it, and how changes are requested and documented.

Excel for analysis: accuracy before appearance

Excel is fast and flexible for entry details and account movements: instant analysis, access down to the document, simple what-if scenarios. It becomes risky as an uncontrolled "operating system", or when the same manual steps repeat every month; that is where Power Query and Excel file governance come in.

PivotTables: summarising thousands of rows

Microsoft describes a PivotTable as "a powerful tool to calculate, summarize, and analyze data that lets you see comparisons, patterns, and trends in your data." It summarises thousands of rows without a formula per cell: expenses by account and then by cost centre, revenue by product or salesperson, receivables by customer with ageing.

Before you start: rules for the source table

RuleWhy
One header row with unique, non-blank labelsMicrosoft recommends this for every column, with no double header rows or merged cells
Tabular data with no blank rows or columnsMicrosoft's guidance for PivotTable source data
One row per transaction, no subtotals inside the dataA PivotTable adds up every row, so a subtotal row would be counted twice
Dates stored as dates, not textGrouping by month or quarter works on date and time fields
Convert the range to an Excel table (Insert > Table)Rows added to a table are included when you refresh, and new columns appear in the field list

The four areas

In the Field List, fields are dragged between four areas:

  • Rows: row labels, such as account or branch.
  • Columns: column labels across the top, such as month.
  • Values: summarised amounts, such as sum of amount or invoice count.
  • Filters: top-level report filters above the PivotTable, such as year or department.

A ticked field goes to its default area: typically nonnumeric fields to Rows, date and time hierarchies to Columns, and numeric fields to Values.

Grouping, filtering and calculations

  • Grouping dates: right-click a value, select Group and choose a period under By (months, quarters, years). With time grouping, Excel detects related time fields and groups them automatically when you add them as rows.
  • Slicers: buttons that filter and also show the current filtering state; a slicer can only connect to PivotTables that share the same data source.
  • Show Values As: instead of calculated-field formulas, show a value as, for example, % of Grand Total, Running Total In or Difference From a base item. To show an amount and its percentage side by side, add the value field twice.

Refreshing: when data is added to the source, PivotTables built on it must be refreshed (Refresh or Refresh All); they can also be set to refresh when the file opens. Newer Excel versions can refresh PivotTables on local workbook data automatically (Auto Refresh), a feature currently available to Microsoft 365 Insider participants.

Power Query: data preparation in refreshable steps

Microsoft defines Power Query as "a data transformation and data preparation engine", with an interface for getting data and an editor for transformations; it saves the shaping steps as a repeatable query you can refresh, in products such as Excel and Power BI Desktop. Monthly manual work (combining statements or branch files, cleaning columns, converting dates) is built once and then refreshed.

Append or Merge?

OperationWhat it doesAccounting example
AppendCreates one table by adding the contents of one or more tables to another, matching columns by name, not positionBranch sales files or monthly expense files with the same columns
MergeJoins two tables by matching values in one or more columns, adding a new column you expand to bring in the second table's fieldsBringing the account name from the chart of accounts by account number

Append adds rows; Merge adds columns. If a column name differs between two files, both columns appear in the result, with nulls where a column is missing, so standardise headers first. A Left outer merge keeps all rows of the first table and brings in any matching rows of the second; if the key repeats in the lookup table, rows multiply when expanded, so compare row counts before and after.

Importing a whole folder for monthly reports

  1. Put the monthly files in a dedicated folder with no other files: every file in the folder and its subfolders is combined.
  2. In Excel, select Data > Get Data > From File > From Folder and choose the folder.
  3. Select Combine > Combine & Transform; Power Query analyses an example file (the first by default) and creates a Transform Sample file query and a function applying its steps to every file.
  4. Edit the example query (columns and data types) and the change applies to all files.
  5. Next month, add the new files and select Refresh All.

The files should share column headers, data types and number of columns, but column order may differ, as matching is by name.

Why refresh fails, and how to prevent it

  • A missing column: "The column … of the table wasn't found" is a step-level error that stops the query loading, usually because a step refers to a column name that no longer exists, for example after a rename in the source. When the number of columns changes but the query needs only specific ones, Choose columns helps it stay resilient, per Microsoft's best practices.
  • Type mismatches: converting a column containing NA to a number produces a cell-level error; use Remove errors or Replace errors, or Keep errors to review the faulty rows.
  • The automatic Changed type step: for Excel, CSV and text files, Power Query by default detects column types from the first 200 rows and adds this step; review it, because changed column names or types can make it an error that stops the query.
  • Footer rows that move: use Remove bottom rows to remove a fixed number of footer rows.

Power BI: from individual analysis to a management dashboard

When everyone must see the same number with the same definition, Power BI complements Excel rather than replacing it:

AspectExcelPower BI
RefreshRefresh or Refresh All, or on opening the fileScheduled refresh in the Power BI service: up to 8 a day with Power BI Pro, up to 48 with Premium per user or Premium/Fabric capacity
CalculationsCell formulas and PivotTable fieldsDAX measures defined once in the model; their values are calculated at query time and never stored
PresentationSheets and filesMulti-page reports; single-page dashboards with visuals from one or more reports, without the filtering or slicing reports offer

The data model: star schema

Microsoft recommends classifying model tables as dimension tables, for filtering and grouping, and fact tables, for summarisation, linked by one-to-many relationships whose "one" side is always the dimension table. An example for the ledger:

TypeTableContents
FactFact_GLOne row per entry line: date, account number, branch, cost centre, amount
FactFact_BudgetBudget by account and month (no branch, so compare it by account and period)
DimensionDim_DateOne row per day, with month, quarter and year
DimensionDim_AccountAccount number, name and type (revenue, expense, asset…)
DimensionDim_BranchBranch and region

Microsoft generally doesn't recommend relating two fact tables directly with many-to-many cardinality: it limits how visuals filter and group, and with data integrity issues some rows might be omitted; shared dimensions with one-to-many relationships are the alternative. As the budget is monthly, store the first day of each month in Fact_Budget; if you show it below month level, make its measure return BLANK, as Microsoft recommends. Time intelligence functions such as TOTALYTD need a date table: a date column with unique values, no blanks and no missing dates, spanning full years (not necessarily calendar years), and marked as a date table for Classic time intelligence. Before publishing, reconcile the model total to the source ledger for the same period.

DAX measures with the right signs

Assumption: Amount in Fact_GL and Fact_Budget is debit minus credit (revenue negative, expenses positive); both relate to Dim_Account and Dim_Date, and Dim_Account[Type] marks revenue accounts "Revenue" and expense accounts "Expense". Revenue's sign is therefore reversed:

Net Amount = SUM ( Fact_GL[Amount] )
Revenue = - CALCULATE ( [Net Amount], Dim_Account[Type] = "Revenue" )
Expenses = CALCULATE ( [Net Amount], Dim_Account[Type] = "Expense" )
Net Profit = [Revenue] - [Expenses]
Net Margin = DIVIDE ( [Net Profit], [Revenue] )
Budget Expenses = CALCULATE ( SUM ( Fact_Budget[Amount] ), Dim_Account[Type] = "Expense" )
Expenses Variance = [Expenses] - [Budget Expenses]
Expenses Variance % = DIVIDE ( [Expenses Variance], [Budget Expenses] )
Revenue YTD = TOTALYTD ( [Revenue], Dim_Date[Date] )

Illustrative check: sales −10,000, rent 3,000, salaries 4,000. Without the sign reversal, Revenue would be −10,000 and Net Profit −17,000; with it, Revenue is 10,000, Expenses 7,000, Net Profit 3,000 and Net Margin 30% (Net Amount, −3,000, is profit with its sign reversed). With an expense budget of 6,500, the variance is 500, or 7.7% over budget.

  • DIVIDE returns BLANK on division by zero unless a third argument is given; it is omitted so a period without revenue shows no misleading zero margin.
  • TOTALYTD's optional year_end_date comes after the optional filter and defaults to 31 December. It is a date string in the locale of the client where the file was created, and Microsoft recommends month/day form so that it resolves to a date; for a year ending 30 June, follow Microsoft's example: TOTALYTD ( [Revenue], Dim_Date[Date], ALL ( Dim_Date ), "6/30" ).

Governance in Power BI

  • A single source of truth: one approved model instead of many personal files.
  • Least privilege: row-level security (RLS) restricts data by role, but it applies only to users with Viewer permissions, not to the workspace Admin, Member or Contributor roles.
  • A published refresh schedule: set the refresh times; scheduled refresh pauses after two months with no visits to any report or dashboard built on the model, and some sources need a gateway.
  • Documented measure changes: no change to a key measure such as net profit without documentation and approval.

Quick-win applications

  • Anomaly detection: unusual movements on an account in a branch, duplicate payments to a supplier for the same amounts, entries outside working hours. See General ledger.
  • Spend analysis by supplier, item and period to find duplication and negotiating room.
  • Receivables ageing: who pays latest, and is the delay linked to branch, product or salesperson?
  • Profitability by product, branch and customer. See Performance ratios.
  • Cash forecasting from expected receipts, payments and bank data. See Rolling forecasts.

Governance and controls

  1. Data controls: unified master data, entry policies and a documented change path.
  2. Transformation controls: steps and queries with clear names and descriptions, as Microsoft recommends for Power Query, plus sample testing.
  3. Presentation controls: a fixed definition and an owner for each measure, permissions and a change log.

See Control procedures and segregation of duties and Financial technology and accounting services.

Sources

Blog