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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create current and last week as a variable

error loading image

Hi,

I would like to create variables like current week and last week but the value of the variable should be calculated. How to do this??

Thanks for help.

1 Solution

Accepted Solutions
Not applicable
Author

Matthias,

Agree with Rainer, but if want more a format with the year inside, just use WeekName() instead of Week() function.

vCurWeek : =WeekName(Today())

vLastWeek : =WeekName(Today()-7)

View solution in original post

4 Replies
Not applicable
Author

Matthias,

here you go:

vCurWeek: Put this in the Value field =Week(Today())

vLastWeek: =Week(Today())-1

Right?

Rainer

Not applicable
Author

Matthias,

Agree with Rainer, but if want more a format with the year inside, just use WeekName() instead of Week() function.

vCurWeek : =WeekName(Today())

vLastWeek : =WeekName(Today()-7)

Not applicable
Author

Thanks a lot.

Anonymous
Not applicable
Author

And, if you want to represent it as the date of week start:
=weekstart(today())
=weekstart(today()-7)
Similar for week end. The possibilities are endless.