Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

New Contributor III

Calculating Date within Range of Dates


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

Re: Calculating Date within Range of Dates

Hello Harrison

Can you please attach an example spreadsheet please?

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

Not applicable

Re: Calculating Date within Range of Dates

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.

Community Browser