Forum Discussion
CliffordAP
5 years agoHelper 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 transactio...
amitchandak
5 years agoSuper User
CliffordAP , Not very clear, Try a measure like
calculate(sum(Table[Amount]), filter(Table, Table[Date] >=today() -7 && Table[Date] <=today()))
- CliffordAP5 years agoHelper II
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.