In this tutorial we’ll look at how to create a Power Pivot running total that allows you to see the aggregation at the month, quarter and year levels enabling you to create charts like this:
Note: parts of this tutorial require Power Pivot in Excel or Power BI. Check if your version of Excel has Power Pivot.
Watch the Video
Download Workbook
Enter your email address below to download the sample workbook.
PivotTable Running Totals using Show Values As
In both regular and Power Pivot PivotTables we can use the Show Values As tools to create running totals through the right-click menu as shown below:
However, when your data is grouped by dates as mine is, these running totals can only be displayed at one level: either Year, Quarter or Month. For example, if I choose the Year level you can see the data at the quarters level is not a running total from one quarter to the next which makes for a confusing PivotTable:
Instead, what we typically want is this where the quarters increment in line with the calendar year:
PivotTable Running Totals using DAX Measure
In Power Pivot PivotTables and Power BI we can use the DAX formula language to write a measure that calculates the running total as you’d expect.
For this your data needs to be loaded to the Power Pivot Data Model, which you can select when creating the PivotTable:
In my data model I have 3 tables, one for Actual Costs, Budgeted Costs and Forecast Costs and a calendar table to relate the tables together enabling me to create a single PivotTable and chart that contains data from all 3 tables:
Now you can set up the measure via the Power Pivot tab on the ribbon > Measures > New Measure:
I’ll create the measure for the Actual Running Total first, which I’ll call Actual RT. In the Measure dialog box assign the measure to the Actual table (1), enter the name (2), formula (3), and formatting (4):
Build the PivotTable being sure to use the date fields from the Calendar table and the new measure you’ve just written:
Please watch the video for step by step instructions.
Jeremy
Hi,
First – thank you for this. Great example.
I think I may have found a flaw, however:
Given there are 2 datasets:
Dataset A
————–
Outgoings for Apr-22 to Mar-23
Contains two columns: [Month] and [Outgoings]
Dataset B
————–
Income for Apr-22 to Mar-23
Contains two columns: [Month] and [Income]
Given there are NO recorded Outgoings for Sep-22
Given there ARE recorded Outgoings for all months other than Sep-22 (i.e. Apr-22 to Mar-23)
Given there ARE recorded Income all year round (i.e. Apr-22 to Mar-23)
Given a [Month] lookup has been created for each of the months Apr-22 to Mar-23
Then: when populating a Power Pivot table, Sep-22 is blank/empty for Outgoings
The rolling-sum works perfectly up to Aug-22 for Outgoings, then shows a blank!
It then “picks up” again with correct calculations on the following month (Oct-22) BUT, if you attempt to perform a calculation (i.e. [Income] – [Outgoings]) you get incorrect results because the [Income] field has a value in it, but the [Outgoings] field is blank for that month (rather than a ‘repeat’ of the previous month’s amount)
One solution (which I’d rather not implement) is to add a row into the raw/source data for Outgoings for Sep-22 with a value of zero. At least I think that would work – haven’t tried it yet.
However, without that, how would you navigate around this issue using just the DAX?
Looking at other comments, it seems to be the policy to forward on to your forum, so (time permitting) will do that shortly!
Many thanks!
Mynda Treacy
Hi Jeremy,
Yes, the formula is not designed to handle missing months. Please post your question and sample file on our Excel forum where someone can help you.
Mynda
Chels
Hi Jeremy, I have exactly the same question. Did you already find a solution? Thank you!
Andy Langshaw
Hi – I have a worksheet with many data fields based on various incomes split in to to rows which represent each month of the year, I have created measures to show what percentage one column field is of another, however, when i change these column fields to running totals the % measure I have created stays the same, how do I create a % measure based on running total values
Mynda Treacy
Hi Andy,
Please post your question and sample Excel file on our forum where we can help you further: https://www.myonlinetraininghub.com/excel-foruma
Martin
Great explanation of running total, it worked flawlessly. If I wanted to add a second or third criteria to the filter, e.g. only sum values for Actual RT with table[other_column] = “x”, how would I do that?
Mynda Treacy
Hard to say without seeing your file. Please post your question on our Excel forum where you can also upload a sample file containing your data model and illustrating your desired result, and we can help you further.