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

Announcements
Join us at Qlik Connect 2026 in Orlando, April 13–15: Register Here!
cancel
Showing results for 
Search instead for 
Did you mean: 
raju_salmon
Creator II
Creator II

Latest 5 weeks selection

Hi,

I am using Calendar from my DB, not generating from QV.

Please find the attached sample QVW, here i have created a button to select latest 5 week selection. However i cannot able to write current string. Which field i need to use for this?

Can anyone help me on this?

Labels (1)
1 Solution

Accepted Solutions
tresB
Champion III
Champion III

You could rather use Week Shift paramter like:

='<=' & Date(WeekEnd(MAX(DATE))-1) & '>=' & WeekEnd(MAX(DATE),-13)

View solution in original post

12 Replies
tresB
Champion III
Champion III

PFA

raju_salmon
Creator II
Creator II
Author

Thank you Tresco.

Based on your string, it is selecting 03 DEC 2015 to 31 DEC 2015 (Latest 5 weeks in 2015).

Can i get latest 5 from max date?

19 DEC 2015 to 09 Jan 2016.

Thanks

tamilarasu
Champion
Champion

Check the below attachment. But the date range which you want must be last 3 weeks.

tresB
Champion III
Champion III

Can you explain the logic how you get  19 DEC 2015 to 09 Jan 2016 ?

raju_salmon
Creator II
Creator II
Author

Hi,

I have data till yesterday in my app, so i need to see latest weeks. Thank you Tresesco.

tamilarasu
Champion
Champion

I just used below expression.


='<=' & Date(WeekStart(Today())-2) & '>=' & Date((WeekStart(Today())-2)-21)


If you got the solution, please close the thread.

raju_salmon
Creator II
Creator II
Author

Hi Nagaraj,

Can we use this on Max(DATE) field instead of today?

Because i may have data till last month, then i need to get from that MAX(DATE) to latest 5 weeks.

In my App, i have dates till dec 2016, however when i left join this to my main table, the latest date is Jan5th2016.

Sorry for not providing this info in mail question. Thanks.

I have tried with below for last 13 weeks,

='<=' & Date(WeekEnd(MAX(DATE))-1) & '>=' & Date(WeekEnd(MAX(DATE))-78)

and it is working.

My question is, as we are calculating number 78 or 21, will it get create any problem if max(Date) changes?

Can we apply the logic on CAL_WEEK_NUM field, so that there will be no problem in future?

tamilarasu
Champion
Champion

Can you post your exact output against your attachment.? It would be helpful for me to provide the solution easily.

tamilarasu
Champion
Champion

Well. I really don't understand your logic. Can you explain me the logic with some example.?