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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
DLROLLINGS
Helper I
Helper I

Cumulative Sum

Hi all,

 

I am having trouble using the cumulative sum of a set period, I have looked at various solutions on here but with each that I use, it is suming the last 12 months as I wish, however this is applying this figure to every date range, ie if the balances summed 10/05/2020 is exactly the same as the balance summed 09/05/2021 (its a weekly balancing every Sunday). 

 

The lastest attempt I am using is

 

Annual Payment =
VAR EarliestDate = Balances[Last Balance Date]-365
RETURN
CALCULATE(
SUM(Balances[Payments Received]),
FILTER(Balances,Balances[Last Balance Date]>EarliestDate && Balances[Payment Reference]=Balances[Payment Reference])
)
 
Sample Data Below - Not this includes one reference number I only want the cumulative sum of each reference so that I can apply region filters are required. 
Pay
Last Balance DatePayment ReferencePayment Received12 Month Total PaymentWhat I want it to say!!!
09/05/202112345230351.64351.64

02/05/2021

12345 351.64121.64
25/04/202112345121.64351.64121.64

 

The raw data has over 23000 reference numbers and goes back over 12 months, but I want the rolling total for each account to be other the last 12 months. Currently, every single record has the same figure throughout the table.

 

I have tried the same as above using a calculated table and using table = distinct(last balance date) but I get the same result. Any help greatly appreciated. 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@DLROLLINGS , I am assuming this is a new column

Try

 

Annual Payment =
VAR EarliestDate = Balances[Last Balance Date]-365
RETURN
CALCULATE(
SUM(Balances[Payments Received]),
FILTER(Balances,Balances[Last Balance Date]>EarliestDate && Balances[Last Balance Date] <=earlier(Balances[Last Balance Date]) && Balances[Payment Reference]=earlier(Balances[Payment Reference]))
)

 

or

 

 

 

Annual Payment =
VAR EarliestDate = Balances[Last Balance Date]-365
RETURN
CALCULATE(
SUM(Balances[Payments Received]),
FILTER(Balances,Balances[Last Balance Date]>EarliestDate && Balances[Payment Reference]=earlier(Balances[Payment Reference]))
)

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

DLROLLINGS
Helper I
Helper I

Cheers Amit, worked like a charm. 

 

For reference, I used the following:

 

Annual Payment =
VAR EarliestDate = Balances[Last Balance Date]-365
RETURN
CALCULATE(
SUM(Balances[Payments Received]),
FILTER(Balances,Balances[Last Balance Date]>EarliestDate && Balances[Last Balance Date] <=earlier(Balances[Last Balance Date]) && Balances[Payment Reference]=earlier(Balances[Payment Reference]))
)

View solution in original post

2 REPLIES 2
DLROLLINGS
Helper I
Helper I

Cheers Amit, worked like a charm. 

 

For reference, I used the following:

 

Annual Payment =
VAR EarliestDate = Balances[Last Balance Date]-365
RETURN
CALCULATE(
SUM(Balances[Payments Received]),
FILTER(Balances,Balances[Last Balance Date]>EarliestDate && Balances[Last Balance Date] <=earlier(Balances[Last Balance Date]) && Balances[Payment Reference]=earlier(Balances[Payment Reference]))
)

amitchandak
Super User
Super User

@DLROLLINGS , I am assuming this is a new column

Try

 

Annual Payment =
VAR EarliestDate = Balances[Last Balance Date]-365
RETURN
CALCULATE(
SUM(Balances[Payments Received]),
FILTER(Balances,Balances[Last Balance Date]>EarliestDate && Balances[Last Balance Date] <=earlier(Balances[Last Balance Date]) && Balances[Payment Reference]=earlier(Balances[Payment Reference]))
)

 

or

 

 

 

Annual Payment =
VAR EarliestDate = Balances[Last Balance Date]-365
RETURN
CALCULATE(
SUM(Balances[Payments Received]),
FILTER(Balances,Balances[Last Balance Date]>EarliestDate && Balances[Payment Reference]=earlier(Balances[Payment Reference]))
)

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.