Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Friends
I have following script in my master calendar to create weeks.
'Week'&Ceil(Day(TRN_DATE)/7) as MonthlyWeek,
I note that in the above syntax week start day is Monday. I want to make the start day as Sunday. Kindly help me to modify the script to suit my requirement.
I think you should use the WeekStart function https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/DateAndTimeFun...
Argument | Description |
---|---|
date | The date to evaluate. |
period_no | shift is an integer, where the value 0 indicates the week which contains date. Negative values in shift indicate preceding weeks and positive values indicate succeeding weeks. |
first_week_day |
If you don't specify first_week_day, the value of variable FirstWeekDay will be used as the first day of the week. If you want to use another day as the first day of the week, set first_week_day to:
The integer returned by the function will now use the first day of the week that you set with first_week_day as base (0). |
What exactly are you trying to get here? Week Numbers with respect to Months?
Jan 1st - Jan 6th - Week1
Jan 7th - Jan 13th - Week2
Jan 14th - Jan 20th - Week3
Jan 21st - Jan 27th - Week4
Jan 28th - Jan 31st - Week5
Feb 1st - Feb 3rd - Week1
and so on...?
Yes Sunny,
That is exactly what I want
Hi Sunny,
I have tried with SET FirstWeekDay=0; but it does not work. Kindly advise me.
Could u pls share a sample