Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

RE:MonthEnd

Hi All,

Settu Periyasamy

hic

adam davies

Sunny Talwar

Marco Wedel

i am facing one issue regarding week and month

i have  fields like   week number    1 to  52    and  months  december,january,February

so issue is  :  in january2017  we have 5 weeks.  but i need     to display 4 weeks only  means

my week start is : Monday

so by below pic

25,26,27,28,29,30,31------   should be december 2016 week 4

29,30,31,1,2,3,4, ------------------- should be in week1 of feb

calender.JPG

15 Replies
rogerioqv
Creator II
Creator II

Friend, have you tried the weekyear function?

Anil_Babu_Samineni

Chanty, Can you create dummy data please which illustrate the output. We are happy with Random dates too

Anyway, look here Recipe for a 4-4-5 Calendar

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Chanty4u
MVP
MVP
Author

No its not working

adamdavi3s
Master
Master

Something like

if( month(weekend(date) > month(weekstart(date),month(weekend(date) ,month(weekstart(date) ) as month?

Depends on what logic you want really, but the 4-4-5 as mentioned above will probably do it

settu_periasamy
Master III
Master III

Hi sureshqv,

Can you create a excel file , what do you have and the expected output in other column?

hic
Former Employee
Former Employee

You need a Broadcast calendar. See Calendars

HIC

Chanty4u
MVP
MVP
Author

thanks Henric.. i tried that  script still its not working .it is not giving as i mentioned

Chanty4u
MVP
MVP
Author

Hi Setu,

PFA. !

ahaahaaha
Partner - Master
Partner - Master

Hi,

I changed the initial settings at the top of the script. The value of FirstWeekDay with 0 changed to 6

SET FirstWeekDay=6;

Script code

Dates:

LOAD

Date(Date('18.12.2016') + RecNo() - 1) as Period

autogenerate(Date(Today()) - Date('18.12.2016') + 1);

autoCalendar:

LOAD

     Period,

     Date(Period) as %Date,

     WeekDay(Period) as DayWeek,

     Week(Period) as NumberWeek

Resident Dates;

DROP Table Dates;

Result

1.jpg

It should be noted that I have Russian localization of QlikView and day of the week starts Monday, not Sunday. If this is the correct decision may be changed by one setting FirstWeekDay.

*********************************************************************************************************************************

You can even offer such variant with the start numeration weeks from the beginning of the year

SET FirstWeekDay=0;

Dates:

LOAD

Date(Date('18.12.2016') + RecNo() - 1) as Period

autogenerate(Date('31.12.2016') - Date('18.12.2016') + 1);

autoCalendar:

LOAD

     Period,

     Date(Period) as %Date,

     WeekDay(Period) as DayWeek,

     Week(Period) as NumberWeek

Resident Dates;

DROP Table Dates;

SET FirstWeekDay=6;

Dates:

LOAD

Date(Date('01.01.2017') + RecNo() - 1) as Period

autogenerate(Date(Today()) - Date('18.12.2016') + 1);

Concatenate(autoCalendar)

LOAD

     Period,

     Date(Period) as %Date,

     WeekDay(Period) as DayWeek,

     Week(Period) as NumberWeek

Resident Dates;

DROP Table Dates;

2.jpg

Regards,

Andrey