Skip to content

Finance - Financial Planning

A financial planning and analysis team, usually called FP&A, helps a company’s executives manage its profitability and decide how to use the cash it expects to generate.

Its work includes:

  • comparing actual results with budgets and forecasts
  • comparing the profit contribution of the company’s products and services
  • comparing cost efficiency across departments
  • building longer-term forecasts, over three to five years, with the executive team, taking account of factors inside and outside the business

Forecasting is the core of the job. A good forecast lets management plan how the expected cash will cover day-to-day running costs and larger capital investment, so that the company can keep growing, stay competitive and meet the goals its leadership has set.

Source: https://corporatefinanceinstitute.com/resources/careers/jobs/financial-planning-and-analysis-fpa/

This page works through an example of the kind of data an FP&A team handles, and turns it into a financial report. The report summarises the company’s main profit and loss cost lines over several periods, and alongside them shows some key performance indicators (KPIs) for the efficiency of its people costs.

  1. Import the cost data exported from the ERP system into the Power Query editor.
  2. Add steps that give each column its correct dimension name.
  3. Use a self-referencing table so that whoever prepares the report can replace those names with headings of their own, where needed. The result is the fact table.
  4. Build the dimension tables that go with the fact table.
  5. Load the fact and dimension tables into the Data Model, where the KPI calculations are written.
  6. Build the financial planning tables in Excel.

A cost report exported from an ERP system often looks like the one below. The dimensions that describe each column of figures, such as the ledger, the scenario and the quarter, are stacked in rows above the figures, while the dimensions that describe each row, such as the cost category and the cost centre, run down the left:

An ERP cost report in which rows for Ledger, Product, Customer, Year, Type of FX Rate, Reporting Currency, Financial Scenario and Financial Quarter sit above four columns of quarterly figures, with Cost Category 1, Cost Category 2, Cost Center and General Ledger down the left

Loaded into the Power Query editor, the report looks like this:

The report in the Power Query editor, where the stacked dimension rows have null in the first four columns and the row labels start on row 8

The aim of this query is to give every column a single header that carries all of its stacked dimension values. Transposing the table first, on the Transform tab, turns the stacked rows into columns:

The transposed table, where Ledger, Product, Customer, Year, Type of FX Rate and Reporting Currency are now column values with one row per quarter

Next, merge every column from Column1 up to the last column before the figures start. Here the delimiter is ~^~, a string unlikely to appear in the data, so that the values can be split apart again later:

The merged column, holding values such as Ledger~^Product^Customer^Year for the dimension names and World Wide^All Products^All Customers^~2021 for each quarter’s values

Transposing the table back gives this:

The table transposed back, with a first row of merged headers and the cost lines below it

Finally, choose Use First Row as Headers, so that the merged values become the column names:

The table with merged headers such as ~^^^^^^^~Cost Category 1 over the cost category, cost centre and general ledger columns

The query is called Fin Costs - Promoted Headers, and its M code is:

let
Source = #"Fin Costs -Source",
#"Transposed Table" = Table.Transpose(Source),
#"Merged First 8 Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Transposed Table", {{"Column4", type text}}, "en-GB"),{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8"},Combiner.CombineTextByDelimiter("~^~", QuoteStyle.None),"Merged"),
#"Transposed Table1" = Table.Transpose(#"Merged First 8 Columns"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table1", [PromoteAllScalars=true])
in
#"Promoted Headers"

Step 2: Give the columns their dimension names

Section titled “Step 2: Give the columns their dimension names”

This query unpivots the figures from the first query, so that each figure gets a row of its own.

  • The second step counts the columns:
= List.Count(Table.ColumnNames(Source))
  • The fifth column from the end holds the merged dimension names, which this query does not need, so it is removed:
= Table.RemoveColumns(Source,{Table.ColumnNames(Source){#"No. of Columns" - 5}})
  • The columns are then counted again:
= List.Count(Table.ColumnNames(#"Removed Columns"))
  • The last four columns, which hold the figures, are unpivoted. The code finds them by position rather than by name, so the query still works when the names change:
= Table.Unpivot(#"Removed Columns", {Table.ColumnNames(#"Removed Columns"){#"No. of Columns 2" - 1}, Table.ColumnNames(#"Removed Columns"){#"No. of Columns 2" - 2}, Table.ColumnNames(#"Removed Columns"){#"No. of Columns 2" - 3}, Table.ColumnNames(#"Removed Columns"){#"No. of Columns 2" - 4}}, "Attribute", "Value")
  • Each figure now sits on its own row, and its dimension values, though not their names, are merged into one column called Attribute:

The unpivoted table, with each general ledger line repeated four times, an Attribute column holding values such as World Wide~^All Products^All Customers^~2021, and a Value column

  • The Attribute column is then split back into separate columns at the delimiter:
= Table.SplitColumn(#"Unpivoted Only Selected Columns", "Attribute", Splitter.SplitTextByDelimiter("~^~", QuoteStyle.Csv))
  • Each dimension value now has its own column, named Attribute.1, Attribute.2 and so on:

The split columns, where Attribute.5 holds Budget FX Rates, Attribute.6 GBP, Attribute.7 Actual or Forecast and Attribute.8 the quarter, beside the Value column

  • The M code for the whole query is:
let
Source = #"Fin Costs - Promoted Headers",
#"No. of Columns" = List.Count(Table.ColumnNames(Source)),
#"Removed Columns" = Table.RemoveColumns(Source,{Table.ColumnNames(Source){#"No. of Columns" - 5}}),
#"No. of Columns 2" = List.Count(Table.ColumnNames(#"Removed Columns")),
#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Removed Columns", {Table.ColumnNames(#"Removed Columns"){#"No. of Columns 2" - 1}, Table.ColumnNames(#"Removed Columns"){#"No. of Columns 2" - 2}, Table.ColumnNames(#"Removed Columns"){#"No. of Columns 2" - 3}, Table.ColumnNames(#"Removed Columns"){#"No. of Columns 2" - 4}}, "Attribute", "Value"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Only Selected Columns", "Attribute", Splitter.SplitTextByDelimiter("~^~", QuoteStyle.Csv))
in
#"Split Column by Delimiter"

This query lists the columns from Query 2 whose names contain Attribute. A later query renames them with their dimension names.

  • First, the column names are read into a list:
= Table.ColumnNames(#"Fin Costs - AFTER Unpivoting")

A list of the column names from Query 2: four merged headers, Attribute.1 to Attribute.8, and Value

The list is converted to a table:

= Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)

The same names as a one-column table

The rows are filtered to keep only the names that contain Attribute:

= Table.SelectRows(#"Converted to Table", each Text.Contains([Column1], "Attribute"))

The table filtered to Attribute.1 to Attribute.8

Finally, an index column is added, numbered from 1:

= Table.AddIndexColumn(#"Filtered Rows", "Index", 1, 1, Int64.Type)

Attribute.1 to Attribute.8 with an Index column numbered 1 to 8

The M code for the query is:

let
Source = Table.ColumnNames(#"Fin Costs - AFTER Unpivoting"),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each Text.Contains([Column1], "Attribute")),
#"Added Index" = Table.AddIndexColumn(#"Filtered Rows", "Index", 1, 1, Int64.Type)
in
#"Added Index"

This query lists the dimension names, one to a row.

  • First, it reads the column names from Query 1, which ends with the promoted headers. Query 2 cannot be used, because it removed the column whose header holds the dimension names.
= Table.ColumnNames(#"Fin Costs - Promoted Headers")

The list looks like this:

The column names from Query 1, including Ledger~^Product^Customer^Year and four headers that start World Wide^~All Products

  • The list is converted to a table:
= Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
  • The table is then filtered to the row that holds the dimension names. Financial Scenario is almost certain to be one of the dimensions, so the filter looks for it:
= Table.SelectRows(#"Converted to Table", each Text.Contains([Column1], "Financial Scenario"))

This leaves the single row that holds every dimension name:

One row holding Ledger~^Product^~Customer and the rest of the merged dimension names

The row is split into separate columns at the ~^~ delimiter:

= Table.SplitColumn(#"Filtered Rows", "Column1", Splitter.SplitTextByDelimiter("~^~", QuoteStyle.Csv))

This gives one column for each name:

The split row, with Ledger, Product, Customer, Year and Type of FX Rate in columns Column1.1 to Column1.5

Transposing the table and adding an index column gives the dimension names in order:

Ledger, Product, Customer, Year, Type of FX Rate, Reporting Currency, Financial Scenario and Financial Quarter with an Index column numbered 1 to 8

The M code for the query is:

let
Source = Table.ColumnNames(#"Fin Costs - Promoted Headers"),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each Text.Contains([Column1], "Financial Scenario")),
#"Split Column by Delimiter" = Table.SplitColumn(#"Filtered Rows", "Column1", Splitter.SplitTextByDelimiter("~^~", QuoteStyle.Csv)),
#"Transposed Table" = Table.Transpose(#"Split Column by Delimiter"),
#"Added Index" = Table.AddIndexColumn(#"Transposed Table", "Index", 1, 1, Int64.Type)
in
#"Added Index"

Query 5: Mapping of Attributes to Dimensions

Section titled “Query 5: Mapping of Attributes to Dimensions”

This query builds a small mapping table, which is used to rename the columns of the unpivoted data from Query 2.

  • It starts from the list of attribute names in Query 3:
= #"List of Attribute Names"

Attribute.1 to Attribute.8 with their Index column

  • It merges that list with the list of dimension names from Query 4, matching on the index column:
= Table.NestedJoin(Source, {"Index"}, #"List of Dimension Names", {"Index"}, "List of Dimension Names", JoinKind.LeftOuter)

Attribute.1 to Attribute.8 with a new List of Dimension Names column holding a Table on each row

  • After the dimension name is expanded, the index column has done its job and is removed:
= Table.RemoveColumns(#"Expanded List of Dimension Names",{"Index"})

Each attribute beside its dimension name, from Attribute.1 with Ledger to Attribute.8 with Financial Quarter

  • The table is transposed:
= Table.Transpose(#"Removed Columns")

The transposed table, with attribute names in the first row and dimension names in the second

  • Finally, it is turned into a list of lists, where each inner list is a pair of an old name and a new name. This is the form that Table.RenameColumns expects.
= Table.ToColumns(#"Transposed Table")

A list of eight items, each one a List

The M code for the query is:

let
Source = #"List of Attribute Names",
#"Merged Queries" = Table.NestedJoin(Source, {"Index"}, #"List of Dimension Names", {"Index"}, "List of Dimension Names", JoinKind.LeftOuter),
#"Expanded List of Dimension Names" = Table.ExpandTableColumn(#"Merged Queries", "List of Dimension Names", {"Column1"}, {"Column1.1"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded List of Dimension Names",{"Index"}),
#"Transposed Table" = Table.Transpose(#"Removed Columns"),
#"List of Lists" = Table.ToColumns(#"Transposed Table")
in
#"List of Lists"

This query uses the mapping from Query 5 to give the columns of Fin Costs - AFTER Unpivoting their dimension names.

  • It starts from the unpivoted data:
= #"Fin Costs - AFTER Unpivoting"

The unpivoted data with columns still named Attribute.5 to Attribute.8

  • One step then renames every attribute column from the mapping:
= Table.RenameColumns(Source, #"Mapping of Attribute to Dimensions")

The columns now carry their dimension names:

The same data with columns named Type of FX Rate, Reporting Currency, Financial Scenario and Financial Quarter

let
Source = #"Fin Costs - AFTER Unpivoting",
Custom1 = Table.RenameColumns(Source, #"Mapping of Attribute to Dimensions")
in
Custom1

Step 3: Let the preparer choose the headings

Section titled “Step 3: Let the preparer choose the headings”

This query and the next two let whoever prepares the report replace the dimension names with headings of their own, where they want to.

  • The query reads the column names from Query 6, after the dimension names have been applied:
= Table.ColumnNames(#"Fin Costs - AFTER ATTR Renaming")

A list of the column names: four merged headers, the eight dimension names and Value

  • The list is converted to a table:
= Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)

The same names as a one-column table

  • The column is renamed from Column1 to Column Headings:
= Table.RenameColumns(#"Converted to Table",{{"Column1", "Column Headings"}})

The table with its column renamed to Column Headings

At this point the query is loaded to a worksheet, where the table looks like this:

A worksheet table titled Free Text Column Header Mappings, with a Column Headings column listing every column name

A User Defined Headings column is typed beside it, and a new heading is entered wherever one is wanted. Here the merged headers get plain names, and Value becomes Amount:

The worksheet table with a User Defined Headings column, giving Cost Category 1, Cost Category 2, Cost Center, General Ledger and Amount as new headings and leaving the dimension names blank

The table, with both columns, is then loaded into Power Query as a new query. This is Query 8, which is separate from Query 7, the query that wrote the table to the worksheet:

The new query, reading the List_of_Columns_with_DMS_Names table from the workbook, with Column Headings and User Defined Headings columns

Back in Query 7, after the step that named the column Column Headings, the new query is merged in, matching on Column Headings:

Query 7 merged with List of Columns with FTXT Names, showing a Table on each row of the new column

Expanding the merge brings each user-defined heading onto the row of the heading it replaces:

Query 7 with each column heading beside its user-defined heading, or null where none was entered

This makes the table self-referencing. Each refresh rewrites the list of headings, and the merge keeps every typed heading beside the right row, even when the columns change.

The M code for Query 7 is:

let
Source = Table.ColumnNames(#"Fin Costs - AFTER ATTR Renaming"),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Column Headings"}}),
#"Merged Queries" = Table.NestedJoin(#"Renamed Columns", {"Column Headings"}, #"List of Columns with FTXT Names", {"Column Headings"}, "List of Columns with FTXT Names", JoinKind.LeftOuter),
#"Expanded List of Columns with FTXT Names" = Table.ExpandTableColumn(#"Merged Queries", "List of Columns with FTXT Names", {"User Defined Headings"}, {"User Defined Headings"})
in
#"Expanded List of Columns with FTXT Names"

This is the query that reads the worksheet table of user-defined headings back in, as described under Query 7.

Query 9: Mapping of DMS Names to FTXT Names

Section titled “Query 9: Mapping of DMS Names to FTXT Names”

This query builds a second mapping table, which renames columns from their dimension names to the user-defined headings.

  • It starts from the table of column headings and user-defined headings:

The table of column headings with their user-defined headings, or null where none was entered

A conditional column then gives the final name for each column, which is the user-defined heading where there is one and the existing heading where there is not:

The table with a Custom column that holds the user-defined heading where one exists, such as Amount for Value, and the existing heading otherwise

The middle column is removed, and the remaining two are transposed:

Two rows, the first holding the merged headers and the second their new names, such as Cost Category 1 and Cost Center

  • Finally, Table.ToColumns turns the table into a list of lists, which the last query uses for the renaming:
= Table.ToColumns(#"Transposed Table")

The M code for the query is:

let
Source = #"List of Columns with FTXT Names",
#"Added Conditional Column" = Table.AddColumn(Source, "Custom", each if [User Defined Headings] = null then [Column Headings] else [User Defined Headings]),
#"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"User Defined Headings"}),
#"Transposed Table" = Table.Transpose(#"Removed Columns"),
#"List of Lists" = Table.ToColumns(#"Transposed Table")
in
#"List of Lists"
  • This query starts from Query 6, in which the attribute columns already have their dimension names:

The query’s first step, = #“Fin Costs - AFTER ATTR Renaming”, showing columns named Type of FX Rate to Financial Quarter and Value

  • It then renames the columns again with the mapping from Query 9, so that every user-defined heading replaces the name before it:

The rename step, = Table.RenameColumns(Source, #“Mapping of DMS Names to FTXT Names”), after which the Value column is called Amount

The M code for the query is:

let
Source = #"Fin Costs - AFTER ATTR Renaming",
#"Renamed Columns" = Table.RenameColumns(Source, #"Mapping of DMS Names to FTXT Names")
in
#"Renamed Columns"

Loaded to a worksheet, the transformed data has one row per figure and one column per dimension, which makes it far easier to analyse:

The processed cost data, with columns for Cost Category 1, Cost Category 2, Cost Center, General Ledger, Ledger, Product, Customer, Year, Type of FX Rate, Reporting Currency, Financial Scenario, Financial Quarter and Amount

Besides the fact table, the model needs dimension tables. This example needs two: a list of cost centres, and a list of financial quarters.

The list starts from a query that references the fact table:

A query whose source is = #“Fin Costs - AFTER FTXT Renaming”, showing its cost category, cost centre and general ledger columns

Other fact tables may hold data for cost centres too, such as staff numbers. Here a second fact table holds headcounts:

An HR Head Count table with Cost Center, HeadCount Category, the same dimension columns as the cost data, and a HeadCount column

Appending the fact tables before building the list makes sure that it includes every cost centre, and not only those in one table.

After the cost table and the headcount table are appended, every column except Cost Center is removed:

The Cost Center column from both tables, with each cost centre appearing several times

Then the duplicates are removed:

The four distinct cost centres: Product Development, Procurement, Marketing & Sales and Finance Department

The query is then loaded to a worksheet.

The quarters need no query, because they do not change. They can be typed straight into an Excel table, shown here beside the cost centre list from the query:

A Cost Center List table with the four cost centres beside a Financial Quarters table listing Q1 to Q4

Step 5: Load the fact and dimension tables into the Data Model

Section titled “Step 5: Load the fact and dimension tables into the Data Model”

Once the fact and dimension tables exist, they are loaded into the Data Model, where the KPI calculations are written. The diagram shows how each dimension table relates to the two fact tables.

The Data Model diagram, where List of Cost Centers and List_of_Financial_Quarters each relate one-to-many to both Fin Costs - AFTER FTXT Renaming and Head Count - AFTER FTXT Renaming, beside a DAX_Table_1 that holds the measures

Three measures serve as example KPIs:

  • Total People Costs, which covers items such as salaries, pensions, employment taxes and bonuses
  • Total HeadCount, which covers full-time, part-time, intern and other staff
  • People Cost per HeadCount, a cost-efficiency ratio

Their DAX is below. Total HeadCount returns the headcount for a quarter when one is selected, and otherwise the average across quarters, because headcounts are not added up over time.

Total People Costs :=
CALCULATE (
SUM ( 'Fin Costs - AFTER FTXT Renaming'[Amount] ),
'Fin Costs - AFTER FTXT Renaming'[Cost Category 2] = "People Costs"
)
Total HeadCount :=
VAR HeadCount =
CALCULATE ( SUM ( 'Head Count - AFTER FTXT Renaming'[HeadCount] ) )
RETURN
IF (
ISFILTERED ( List_of_Financial_Quarters[Financial Quarter] ),
HeadCount,
AVERAGEX (
ADDCOLUMNS (
GROUPBY (
'Head Count - AFTER FTXT Renaming',
List_of_Financial_Quarters[Financial Quarter]
),
"HeadCount", CALCULATE ( SUM ( 'Head Count - AFTER FTXT Renaming'[HeadCount] ) )
),
[HeadCount]
)
)
People Cost per HeadCount:=DIVIDE([Total People Costs], [Total HeadCount], 0)

Step 6: Build the financial planning report

Section titled “Step 6: Build the financial planning report”

With the model in place, a report like the one below can be built from PivotTables. It summarises the profit and loss cost lines by quarter, shows the KPIs underneath, and can be filtered by cost centre or quarter with slicers.

A P&L summary PivotTable of costs by category and quarter, a KPI PivotTable showing Total People Costs, Total HeadCount and People Cost per HeadCount by quarter, and slicers for Cost Center and Financial Quarter

The report groups costs only as fixed, variable and other. A more useful grouping could follow the business areas in Porter’s value chain, a framework that divides an organisation into the primary and support activities through which it creates a product or service.

Costs could then be compared across areas such as marketing, product development, finance, technology development, inbound logistics and procurement, which would give executives a clearer view of how each part of the business is performing.

The workbook described on this page can be downloaded here: Finance - Financial Planning

  • Combining stacked headers: a later page reaches a similar result with a custom function, in far fewer steps and queries. Read more