19.2Running totals and moving averages
For a running total in classic DAX, you combined CALCULATE, FILTER, ALL and MAX, or used WINDOW. In a visual calculation, a single function is enough.
19.2.1RUNNINGSUM
In Excel
| Excel | SUM($G$2:G2), copied down |
|---|---|
| Match |
You need it when the running total must be read in the visual itself, year after year.
RUNNINGSUM can be written only in a visual calculation. Power BI rejects it in a measure, a calculated column or a calculated table. On izyDAX, the names of the functions reserved for visual calculations are written in orange.
RUNNINGSUM adds up the value of the row and those of the previous rows, in ascending order of the axis values.
It expects a field of the visual, written in square brackets, such as [Revenue]. Here, the axis of the visual holds the years.
| Year | Running Total |
|---|---|
| 2024 | 750,000 |
| 2025 | 1,700,000 |
| Total | 1,700,000 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
It is the result of the “Running Total Revenue” measure, without any filter to write.
Practice
Each exercise is solved with the function you just discovered. Two exercises per function, a direct use and a combined use, from easiest to hardest, on data other than the course data. Pick the right formula out of five.
Direct useVisual calculationDifficulty
A weather station has a Table visual by month with its “Rain” measure, which adds up the rain that fell, in millimeters. The month column is sorted in calendar order. Write the “Cumulative Rain” visual calculation on this visual.
The visual Month Rain January 80 February 60 March 45 Which formula should you write for “Cumulative Rain”?
Combined useVisual calculationDifficulty
A carrier aims to deliver 200 parcels over the quarter. It has a Table visual by month with its “Parcels” measure, which adds up the parcels. The month column is sorted in calendar order. Write the “Left to Deliver” visual calculation on this visual, the number of parcels still missing to reach 200 at the end of each month.
The visual Month Parcels January 80 February 60 March 45
The rest of this lesson is part of izyDAX Pro
You have just read the first section. The next one, its animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.