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: 
Jarvis
Contributor
Contributor

How to load this week and last year this week data in the Qliksense app

Hi All,

I need to show the takings value of this week and last year same week data in a Qliksense app.Can anyone please help me in this?

2 Replies
justISO
Specialist
Specialist

Hi, try to use simple WHERE clause when loading your table:

LOAD *

FROM [YourTable]

WHERE week(YourDateField)=week(Today()) and (Year(YourDateField)=Year(Today()) or Year(YourDateField)=Year(Today())-1);

sidhiq91
Specialist II
Specialist II

@Jarvis  There are plenty of ways to get this done. You can create four Variables in the Load script something like below:

VCurrentYearWeekstart: Date(Weekstart(Addyears(today(),0)),'MM/DD/YYYY')

VCurrentYearWeekend: Date(Weekend(Addyears(today(),0)),'MM/DD/YYYY')

VPrevYearWeekstart:Date(Weekstart(Addyears(today(),-1)),'MM/DD/YYYY')

VPrevYearWeekend:Date(Weekend(Addyears(today(),-1)),'MM/DD/YYYY')

Now in the Load

Temp:

Load *

from Table_Name

where (Date_field>='$(VCurrentYearWeekstart)' and Date_field<='$(VCurrentYearWeekend)' )

or(Date_field>='$(VPrevYearWeekstart)' and Date_field<='$(VPrevYearWeekend)' )

Or you can follow what @justISO mentioned as well.