Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
voidbydefault
Helper I
Helper I

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 AmountCumulative Total
1-Jan-221001,050
15-Jan-222001,250
.........
31-Dec-222001,450
1-Jan-232501,700
.........
27-May-233002,200
Total1,0503,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
raksone
Frequent Visitor

Can you share your PBI?

Nopes. Apologies.

voidbydefault
Helper I
Helper I

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
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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