Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI ALl,
I am having one field called "week" which contains the week data like below.
Week
2022/01
2022/02
.....
2022/12
Now i want to load last weeks data from week field into Qlik through script.
Can you help me ASAP?
Hi @Suri6999
You want a WHERE statement. Is that week number plain text in the source?
If so you will need to construct the week in that format:
WHERE Week = WeekYear(today()-7) & '/' & num(Week(today()-7), '00')
Hope that helps.
Steve
seems like it will give the data for latest week
But i want data for last 4 weeks..
Sorry @Suri6999
I was looking at the description, rather than the subject of the post.
You just need to build this out with OR statements:
WHERE Week = WeekYear(today()-7) & '/' & num(Week(today()-7), '00')
OR Week = WeekYear(today()-14) & '/' & num(Week(today()-14), '00')
OR Week = WeekYear(today()-21) & '/' & num(Week(today()-21), '00')
OR Week = WeekYear(today()-28) & '/' & num(Week(today()-28), '00')
If you also have a date field in the source data, rather than just a Week value then you could do it much more elegantly with that, e.g.
WHERE Date >= WeekStart(today()-28) AND Date <= WeekEnd(today()-7)
That is making an assumption about your data which might not be correct though.
Hope that helps.
Steve