cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Frequent Visitor

## Problem with cumulative(running) total

Hi,

I am trying to calculate a cumulative/running total using:

``````Running Invoiced Amounts =
VAR CurrentDate = MAX(AR_Balances[GL Date])
RETURN

CALCULATE(
SUMX(AR_Balances, AR_Balances[Invoice Amount]),
FILTER(
ALL(AR_Balances),
AR_Balances[GL Date] <= CurrentDate
)
)``````

Above gives matrix following output:
 GL Date* Invoice Amount Cumulative Total 1-Jan-22 100 1,050 15-Jan-22 200 1,250 ... ... ... 31-Dec-22 200 1,450 1-Jan-23 250 1,700 ... ... ... 27-May-23 300 2,200 Total 1,050 3,050

*GL Date = Invoice Date

Problems I am unable to fix::

1. Starting of cumulative total (1,050) is the sum of all invoices (total). Why and how to prevent so?

2. Cumulative total seemingly works (if starting 1,050 is ignored), but I expect it to reset as soon as the year changes on 31-Dec. How to achieve this?

Thanks.

3 REPLIES 3
Frequent Visitor

Frequent Visitor

Nopes. Apologies.

Frequent Visitor

Update:
I have managed to fix the first issue where cumulative total started with the sum of all invoices (i.e. 1,050) using below DAX. Please help me with the second problem. Thanks:

Solution to # 1:

``````Running Invoiced Amounts =
VAR CurrentDate = MAX(AR_Balances[GL Date])
RETURN

CALCULATE(
SUMX(AR_Balances, AR_Balances[Invoice Amount]),
AR_Balances[GL Date] <= CurrentDate
)``````

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors