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

Calculating Date within Range of Dates

Gurus,

I have a Date Table with field WeekStartDate and my Fact Table with field DateOfSale. I want to compare sum of sales for this week (Week-To-Date) with sales for previous week (TOTAL Previous Week).

Kindly assist

2 Replies
john_s_w_wood
Creator
Creator

Hello Harrison

Can you please attach an example spreadsheet please?

We may be able to do something using the weekstart, weekend, functions

Not applicable

Why dont you use something like this

Sum({$<Date_id = {">=$(=WeekStart(Date_id))<=$(=Date_id)"}>} [sale])  for current week till today.

Sum({$<Date_id = {">=$(=WeekStart(date(num(Date_id)-7)))<=$(=WeekEnd(date(num(Date_id)-7))))"}>} [sale]) for the entire last week.

In case you want to include the entire current week, just try using Weekend in the first statement.