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.
The steps from raw data to report
Section titled “The steps from raw data to report”- Import the cost data exported from the ERP system into the Power Query editor.
- Add steps that give each column its correct dimension name.
- 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.
- Build the dimension tables that go with the fact table.
- Load the fact and dimension tables into the Data Model, where the KPI calculations are written.
- Build the financial planning tables in Excel.
Step 1: Import the data
Section titled “Step 1: Import the data”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:

Query 1: Fin Costs - Promoted Headers
Section titled “Query 1: Fin Costs - Promoted Headers”Loaded into the Power Query editor, the report looks like this:

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:

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:

Transposing the table back gives this:

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

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”Query 2: Fin Costs - AFTER Unpivoting
Section titled “Query 2: Fin Costs - AFTER Unpivoting”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 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 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"Query 3: List of Attribute Names
Section titled “Query 3: List of Attribute Names”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")
The list is converted to a table:
= Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
The rows are filtered to keep only the names that contain Attribute:
= Table.SelectRows(#"Converted to Table", each Text.Contains([Column1], "Attribute"))
Finally, an index column is added, numbered from 1:
= Table.AddIndexColumn(#"Filtered Rows", "Index", 1, 1, Int64.Type)
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"Query 4: List of Dimension Names
Section titled “Query 4: List of Dimension Names”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 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:

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:

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

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"
- 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)
- After the dimension name is expanded, the index column has done its job and is removed:
= Table.RemoveColumns(#"Expanded List of Dimension Names",{"Index"})
- The table is transposed:
= Table.Transpose(#"Removed Columns")
- 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")
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"Query 6: Fin Costs - AFTER ATTR Renaming
Section titled “Query 6: Fin Costs - AFTER ATTR Renaming”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"
- 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:

let Source = #"Fin Costs - AFTER Unpivoting", Custom1 = Table.RenameColumns(Source, #"Mapping of Attribute to Dimensions")in Custom1Step 3: Let the preparer choose the headings
Section titled “Step 3: Let the preparer choose the headings”Query 7: List of Columns with DMS Names
Section titled “Query 7: List of Columns with DMS Names”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")
- The list is converted to a table:
= Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
- The column is renamed from Column1 to Column Headings:
= Table.RenameColumns(#"Converted to Table",{{"Column1", "Column Headings"}})
At this point the query is loaded to a worksheet, where the table looks like this:

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 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:

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

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

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"Query 8: List of Columns with FTXT Names
Section titled “Query 8: 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:

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 middle column is removed, and the remaining two are transposed:

- 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"Query 10: Fin Costs - AFTER FTXT Renaming
Section titled “Query 10: Fin Costs - AFTER FTXT Renaming”- This query starts from Query 6, in which the attribute columns already have their dimension names:

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

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"The finished fact table
Section titled “The finished fact table”Loaded to a worksheet, the transformed data has one row per figure and one column per dimension, which makes it far easier to analyse:

Step 4: Build the dimension tables
Section titled “Step 4: Build the dimension tables”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 of cost centres
Section titled “The list of cost centres”The list starts from a query that references the fact table:

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

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:

Then the duplicates are removed:

The query is then loaded to a worksheet.
The list of quarters
Section titled “The list of quarters”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:

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
Section titled “The Data Model”
KPI measures
Section titled “KPI 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.

Further ideas
Section titled “Further ideas”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.
File to download
Section titled “File to download”The workbook described on this page can be downloaded here: Finance - Financial Planning
See also
Section titled “See also”- Combining stacked headers: a later page reaches a similar result with a custom function, in far fewer steps and queries. Read more