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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Yazid
Helper I
Helper I

Create a cumulative sum colum in function of date (sorted from oldest to most recent)

Dear,

 I want to create (i.e add) a column G such as below:

 

Yazid_0-1716906390755.png

 

This is easy to do on Excel:

for a date (t), I sum its corresponding amount + the amount on date (t-1)

 

How Can I create such function on PowerBi (DAX) ?

 

Thanks in advance for your support !

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Yazid ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1716949425930.png

 

2. create a measure with below dax formula

 

MEASURE =
VAR tmp =
    WINDOW ( 1, ABS, 0, REL, ALLSELECTED ( 'Table'[Date], 'Table'[Forecast] ) )
RETURN
    SUMX ( tmp, [Forecast] )

 

 

3. add a table visual with field and measure

vbinbinyumsft_0-1716952598239.png

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Once you have a Calendar Table, this measure should work

Total = sum(Data[Amount])

Total YTD = calculate([Total],datesytd(calendar[date],"31/12"))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ray_Minds
Continued Contributor
Continued Contributor

image.png


Did I answer your question? Mark my post as a solution! This will help others on the forum!

Ashish_Mathur
Super User
Super User

Hi,

Once you have a Calendar Table, this measure should work

Total = sum(Data[Amount])

Total YTD = calculate([Total],datesytd(calendar[date],"31/12"))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Yazid ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1716949425930.png

 

2. create a measure with below dax formula

 

MEASURE =
VAR tmp =
    WINDOW ( 1, ABS, 0, REL, ALLSELECTED ( 'Table'[Date], 'Table'[Forecast] ) )
RETURN
    SUMX ( tmp, [Forecast] )

 

 

3. add a table visual with field and measure

vbinbinyumsft_0-1716952598239.png

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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