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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Previous Week

Hi

I have 2 variables vStart and vEnd, i need to give an expression so that i display Last week and This Week,Week should start on Sunday , When i click on This Week button , Date value should set such that , vStart = Sunday of this week adn vEnd = today

2Button :

Last Week :

vStart = Sunday of last Week

vEnd = Saturday of Last Week.

Can any body please help me in writing the expression for the above.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

This week:
vStart = weekstart(today(),0,-1)
vEnd = today()

Last week:
vStart = weekstart(today(),-1,-1)
vEnd = weekend(today(),-1,-1)

View solution in original post

3 Replies
tresesco
MVP
MVP

try something like this:

vEnd=today() // for current week

vStart=Date(Num(today()) - weekday(today())) // for current week Sunday

OR, Date(Num(today()) - weekday(today()) - 1) // i don't remeber what is the weekday value for sunday, so may be this -1 adjusment be required. just try both of them which works.

implement the same logic for last week with concept Week=week-1;

Regards, tresesco

Anonymous
Not applicable
Author

Thank you , i able to get this week by using the expression for

vStart = =Date(Num(today()) - weekday(today()) - 1)

vEnd = today()

But by replacing Today() by Week - 1 did not work , could any body please help me in getting the revious week , previous week should start from Sunday of last week

and End on Sat of Last Week.

Please Help...

Anonymous
Not applicable
Author

This week:
vStart = weekstart(today(),0,-1)
vEnd = today()

Last week:
vStart = weekstart(today(),-1,-1)
vEnd = weekend(today(),-1,-1)