Forum Discussion
Aggregate Count & Sum by Customer Over Time
Thank you Angelia, I appologize if I wasn't clear in my original post. The Today()-6 was supposed to be a "in the previous week" calculation. I've been able to get the sums for individual days, but not the running total for the previous 7 days.
Example, I'm having trouble finding solutions for the "Previous Week Sales" aggregation piece, by customer, by product:
| Customer | Product | Date | Sale | Current Day Sales | Previous Week Sales |
| 1 | A | 1/1/2017 | $100 | $300 | $300 |
| 1 | A | 1/1/2017 | $200 | $300 | $300 |
| 1 | A | 1/3/2017 | $100 | $100 | $400 |
| 1 | B | 1/3/2017 | $200 | $200 | $200 |
| 1 | A | 1/5/2017 | $200 | $200 | $600 |
Thank you in advance!
Hi JNTX,
What's calculation rule for the "Previous Week Sales" based on your given data?
Best Regards,
Angelia
- JNTX8 years agoNew Member
I appologize, I don't understand your question. I'm trying to figure out how to do the sum calculation for the previous week based on customer and product. Seen above in the mockup.
- v-huizhn-msft8 years ago
Microsoft Employee
Hi JNTX,
I mean how to get the column below. What's the calculation rule?
Best Regards,
Angelia- JNTX8 years agoNew Member
I don't know the DAX of it but it's:
sum(sales)
where date <= date and date >= date-7 days
group by customer, product