Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
yasmeenk
Partner - Creator
Partner - Creator

Weekstart should be based on weekday

Hi all,

My issue is, I need to create a calendar in which weekstart date should change according to my weekday. Ex. If I select weekday as Tuesday then my weekstart date should automatically change to Tuesday.

Regards,

Yasmeen

4 Replies
Gysbert_Wassenaar

The Weekstart function accepts an parameter for the day that should be used as the start of the week: weekstart ( '2016-01-12', 0, 2 ). If that should depend on a selection then use a variable with an expressions that calculates the weekday number of the selected day and use that weekstart ( '2016-01-12', 0, $(vWeekDayNumber) )


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Just a minor correction, I think WeekDay start counting from 0

(equals Monday, using default weekday counting, i.e. if not changed in script in a recent QV version).

Hence Tuesday would probably be represented by 1, this should be used as weekstart offset when you want to start the week on midnight between monday and tuesday.

weekstart ( '2016-01-12', 0, 1 )

Gysbert_Wassenaar

You're absolutely right. I often get this mixed up.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Me too. Index start is not consistent in Qlik between functions