Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gireesh1216
Creator II
Creator II

How to get the last 7 days sales without using TODAY() function?

HOW TO GET LAST 7 DAYS SALES WITHOUT USING TODAY() FUNCTION?

If I select 1/25/2016 i need to display 7 days sales(1/18/2016 to 1/24/2016)

last 7 days sales is:119

please find attachment

4 Replies
swuehl
MVP
MVP

Maybe something like

=Sum({<Date = {">=$(=Date(Max(Date)-7,'M/D/YYYY'))<$(=Date(Max(Date),'M/D/YYYY'))"}>} Sales)

sunny_talwar

The expression is the same, but I usually right the expression out like this:

=Sum({<Date = {"$(='>=' & Date(Max(Date)-7,'M/D/YYYY') & '<' & Date(Max(Date),'M/D/YYYY'))"}>} Sales)

The reason I do this is because in case you wish to know what is the range you have added in your expression. You can grab the part between the dollar sign expansion (part in red) and paste it in a text box object to see the range:

='>=' & Date(Max(Date)-7,'M/D/YYYY') & '<' & Date(Max(Date),'M/D/YYYY')

This in a text box object should give you the required range in the format of your date field. If it is not, then you have a problem and need to fix this part for your set analysis to work.

Here is a sample:

When no selection

Capture.PNG

When we select another date

Capture.PNG

wcilliers
Partner Ambassador
Partner Ambassador

Hi Sunny,

I have a question to your post above. Please can you let me know if it is possible to have, in that same straight table that you have, a second column, that lists the last seven days for every date in the list? I don't necessarily want to have a date selected...

Hope that makes sense.

Thanks,

swuehl
MVP
MVP

You can use

The As-Of Table

to achieve what you want.