Forum Discussion
a68tbird
Resolver II
8 years agoCalculate Sales Past 30 Days
Hello All - I can't quite figure out why my formula isn't working here. I'm trying to calculate the sales from the past 30 months using the following: TotalSales30Day =
CALCULATE (
SUM ( O...
- 8 years ago
Hi a68tbird
It seems you may try to use below measure:
TotalSales30Day = CALCULATE ( SUM ( Orders[Quantity] ), DATESINPERIOD ( Orders[OrderDate], MAX ( Orders[OrderDate] ), -30, DAY ) )Regards,
Cherie
a68tbird
Resolver II
8 years agoThanks johnmc, but that didn't seem to do anything for me either.
v-cherch-msft
Microsoft Employee
8 years agoHi a68tbird
It seems you may try to use below measure:
TotalSales30Day =
CALCULATE (
SUM ( Orders[Quantity] ),
DATESINPERIOD ( Orders[OrderDate], MAX ( Orders[OrderDate] ), -30, DAY )
)Regards,
Cherie
- a68tbird8 years ago
Resolver II
Thanks Cherie. That did work. I guess there's something wrong with my relationship between the calendar table and orders table? I can't understand why my original formula didn't work. All other examples of this formula that I've seen, use reference to the calandar table.
But all good!