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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
CliffordAP
Helper II
Helper II

Row-wise Sum within a date range

Hello all,

I am trying to do an aggregation of transactions that happen between people and between a date range of 7 days.

I want this calculation to be done row-wise, meaning that every transaction will show a sum of transactions within the last 7 days.

Here is what the data looks like, and the final column is the output I am looking for.

CliffordAP_0-1620054193042.png

See how for every record, the calculation sums all transactions within the last 7 days for that person.

Does anyone have any ideas? I have tried a few CALCULATE functions, and I don't see any posts similar to this. I'm sure there must be a way to do this.

 

Thank you

2 REPLIES 2
amitchandak
Super User
Super User

@CliffordAP , Not very clear, Try a measure like

calculate(sum(Table[Amount]), filter(Table, Table[Date] >=today() -7 && Table[Date] <=today()))

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

Ah, I do need to clarify.
I don't want the previous 7 days from today, I need the previous 7 days from the recorded date.
So for each record, the calculation will look into the previous 7 days from the recorded date and sum the transactions within those 7 days.
I'm getting something close with;
CALCULATE(SUM('table'[amount])
                ,ALLSELECTED()
                ,DATESBETWEEN('table'[Date],'table'[Date],DATEADD('table'[Date],-7,DAY)))


But it's not perfect..

Thank you for your response.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

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