Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get last week value in set analysis??

Team,

I could get value for current week sale , but in my scenario i need to get value for last week sale so i need to use [week date] - 7 in my set analysis !

Please share your thoughts!!

1 Solution

Accepted Solutions
andrey_krylov
Specialist
Specialist

Hi, Ashok. Try this set analysis

{< [YourDateField] = {">=$(=WeekStart(Today() - 7))<=$(=WeekEnd(Today() - 7))"} >}

View solution in original post

4 Replies
andrey_krylov
Specialist
Specialist

Hi, Ashok. Try this set analysis

{< [YourDateField] = {">=$(=WeekStart(Today() - 7))<=$(=WeekEnd(Today() - 7))"} >}

Anonymous
Not applicable
Author

Thanks for your response Andrey! will try and get back to you!

Michiel_QV_Fan
Specialist
Specialist

Do you use a master calendar?

Add a week id to that with autonumber: autonumber(Year(Date)&Week(Date)) as Week_ID.

this will give a sequencial number starting from the first date (be careful with week 53, is it in the old year or the new .....)

Use this in your set analysis:

Sum({<Week_ID = {"$(=max(Week_ID)-1)"}>}whatever)

venkym1997
Contributor
Contributor

Hi Andrey ,

I have scenario where we don't have dates for weekends and I want calculate average for last 7 data points 

The above expression will work if dates are in sequence like 3,4,5,6,7,8,9

In my case dates are like 3,4,5,6,9,10,11 , how can I achieve 7 days avg here?