Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ravindraa
Creator
Creator

weekstart and week end dates

Hi experts ,

i Have struck one place please give me any suggesion to come out. my requirement is i have date,country,sales fileds ,i have to show the sales as week wise for this i have created weekstart filed using that i am creating charts , in those charts i have to display one charts last 10 week data  and while creating chart i have to consider week satrt and week end dates as differnet for each country , so per i have used only one method i didn't use like this type of rquirement please give me any suggesion .

my requirement is using date filed i have created weeksatrted date filed normaly it is displaying dates monday to sunday , but in my rquiremnent for

IND          ----> Friday-Thursday

CANADA ---->wednesday-Tuseday

China     ----->Monday - sunday

Japan    ------>Saturday-Friday

USA       ------>Friday-Thursday.

like wise i have to displaythe data but in dimention i have to use only weekstart field only , please give me any suggesion.

please find the attachement doc and application.

thanks in advance.

1 Solution

Accepted Solutions
Kushal_Chawda

please see the attached file.

View solution in original post

9 Replies
Anonymous
Not applicable

Have a look at the weekoffset parameter to the WeekStart() and WeekEnd() functions.

Entry from the Help pasted in below.

WeekStart(date [, shift = 0 [,weekoffset = 0]])

Returns a value corresponding to a timestamp with the first millisecond of the first date ( Monday ) of the calendar week containing date. The default output format will be the DateFormat set in the script. 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. If you want to work with weeks not starting midnight between Sunday and Monday, indicate an offset in days in weekoffset. This may be given as a real number indicating days and/or fractions of a day.

Examples:

weekstart ( '2006-01-12' ) returns '2006-01-09' with an underlying numeric value corresponding to '2006-01-09 00:00:00.000'

weekstart ( '2006-01-12', -1 ) returns '2006-01-02' with an underlying numeric value corresponding to '2006-01-02 00:00:00.000'

weekstart ( '2006-01-12', 0, 1 ) returns '2006-01-10' with an underlying numeric value corresponding to '2006-01-10 00:00:00.000'

WeekEnd(date [, shift = 0 [,weekoffset = 0]])

Returns a value corresponding to a timestamp with the last millisecond of the last date ( Sunday ) of the calendar week containing date The default output format will be the DateFormat set in the script. 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. If you want to work with weeks not starting midnight between Sunday and Monday, indicate an offset in days in weekoffset. This may be given as a real number indicating days and/or fractions of a day.

Examples:

weekend ( '2006-01-12' ) returns '2006-01-15' with an underlying numeric value corresponding to '2006-01-15 23:59:59.999'

weekend ( '2006-01-12', -1 ) returns '2006-01-08' with an underlying numeric value corresponding to '2006-01-08 23:59:59.999'

weekend ( '2006-01-12', 0, 1 ) returns '2006-01-16' with an underlying numeric value corresponding to '2006-01-16 23:59:59.999'

ravindraa
Creator
Creator
Author

Hi Bill Markham,

  thanks for replay but i need differnet weekstart and end date as country wise please find the attached documents . please give me any suggesion on this.

Thanks in advance all

Anonymous
Not applicable

As you seem to have started doing have an if statement and or each country do it the appropriate way for that country.

ravindraa
Creator
Creator
Author

Hi Bill Markham,

  it is not giving values , please give me right way direction . thank in advance Bill Markham.

ravindraa
Creator
Creator
Author

Hi experts ,

  Please look into this and give to me some suggesion , whether it is possible in Qlikview or not if possible kindly tell me some suggsion to come out from this.

thanks in advance.

Kushal_Chawda

please see the attached file.

ravindraa
Creator
Creator
Author


Hi Kush,

  thank you very much for reply but for all country the week start date is same (i mean monday to sunday ) but for each country has to start one weekday like below.

IND          ----> Friday-Thursday

CANADA ---->wednesday-Tuseday

China     ----->Monday - sunday

IND        ------>Monday-Sunday

Japan    ------>Saturday-Friday

USA       ------>Friday-Thursday.

please give any suggesion on this .thank you very much for advance.

Kushal_Chawda

Hi Ravindra,

Don't look at the Weekstar_c & countries field, look at the WeekStart & Contry field which I have created in the script.

It's working fine.

ravindraa
Creator
Creator
Author

Hi Kush,

  Thank you very much for heling it is working fine thank you very much