Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date - Last 7 days from data reload date (Qlik Sense)

Hi!

I've been strugling to create a script/measure to calculate sales for the the last 7 days from upload date.

Example:

Let's assume these are the most recent records available:

Sale Date:  01/11/2014  Sales amount: $50

                   02/11/2014                           $55

                   03/11/2014                           $45

                   04/11/2014                           $45

                   05/11/2014                           $60

                   06/11/2014                           $40

                   07/11/2014                           $55

Data uploaded in Qlik on 08/11/2014 (daily load).

I'd like to see sales amount for each day on the chart. It would be great if I could use date filter too, so if I choose a different date it would show sales amount by day for the last 7 days from selected day.

Hope that makes sense. All ideas and suggestions are welcome.

Many thanks,

Linas

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Create a chart

Dimension

Date

Expression

SUM({<Date = {">=$(Date(Today()-6))<=$(Date(Today()))"}>}Amount)

or

SUM({<Date = {">=$(Date(Max(Date)-6))<=$(Date(Max(Date)))"}>}Amount)

View solution in original post

3 Replies
MK_QSL
MVP
MVP

Create a chart

Dimension

Date

Expression

SUM({<Date = {">=$(Date(Today()-6))<=$(Date(Today()))"}>}Amount)

or

SUM({<Date = {">=$(Date(Max(Date)-6))<=$(Date(Max(Date)))"}>}Amount)

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Perhaps this document helps: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand
Not applicable
Author

Manish,

Your answer was very close, this is what worked for us:

SUM({<Date={">=$(=date(Max(Date)-7))<=$(=date(Max(Date)-1))"},Date= >} Amount)

Thanks,

Linas