Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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.

Tags (1)
1 Solution

Accepted Solutions
Not applicable

How to create current and last week as a variable

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)

4 Replies
Not applicable

How to create current and last week as a variable

Matthias,

here you go:

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

vLastWeek: =Week(Today())-1

Right?

Rainer

Not applicable

How to create current and last week as a variable

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

How to create current and last week as a variable

Thanks a lot.

mov
Esteemed Contributor III

How to create current and last week as a variable

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.

Community Browser