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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
rschaudhr
Resolver II
Resolver II

Calculated Column sum last 60 days

Here is the data below:

 

DateIndexDataCalculated column - Data_Index
2018011100 
2018022200 
201803350350
201805450300
2018065400500
201809625475

 

So I have the above table. I have date, index and data column. I want to create a calculated column with takes the values from index and data and add the last 3 day (including the current row). So for example, index 3, the calculated column would have 350 which is (50 [index 3] + 200[index 2] + 100[index 3]). 

Is there any way to accomplish this?

Thank you

1 ACCEPTED SOLUTION

@amitchandak  and @Greg_Deckler 

 

The code is working. Thank you both!

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@rschaudhr , a new column like

sumx(filter(Table, [index] <=earlier([index]) && [index] >=earlier([index])-2),[Data])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  and @Greg_Deckler 

 

The code is working. Thank you both!

Greg_Deckler
Community Champion
Community Champion

@rschaudhr So, maybe:

Column =
  VAR __Min = [Date]-60
RETURN
  SUMX(FILTER('Table',[Date]<=EARLIER([Date]) && [Date]>=__Min),[Date])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi Thanks for the code. However, it is adding the dates not the data. I will see if I can modify it.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.