Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

second sunday in December of Next year

hi all,

I have a date filed with everyday in the year. I need to create a new column to show for each date the next year December second Sunday date.

for example today we are in 11/3/2015.. next year is 2016.. second Sunday in Dec 2016 is 12/11/2106 and need to do the same thing for two years from the date so it will be 12/10/2017..

Any idea how to do the logic..

Thank you in advance!

1 Solution

Accepted Solutions
sunny_talwar

This:

Table:

LOAD *,

  WeekDay(FlagDate) as Day,

  WeekDay(FlagDate1) as Day1;

LOAD *,

  WeekEnd(YearEnd(AddYears(Date, 1)) - 23) as FlagDate,

  WeekStart(YearEnd(AddYears(Date, 1)) - 17, 0, 3) as FlagDate1;

LOAD Date(MakeDate(2013, 1, 1) + RecNo() - 1) as Date

AutoGenerate MakeDate(2030, 1, 1) - MakeDate(2013,1,1);

FlagDate is Sunday

FlagDate1 is Thursday

View solution in original post

4 Replies
sunny_talwar

May be this:

Table:

LOAD *,

  WeekEnd(YearEnd(AddYears(Date, 1)) - 23) as FlagDate;

LOAD Date(MakeDate(2013, 1, 1) + RecNo() - 1) as Date

AutoGenerate MakeDate(2019, 1, 1) - MakeDate(2013,1,1);

alec1982
Specialist II
Specialist II
Author

thank you so much! is there a way the second Thursday of the same month as well?

sunny_talwar

This:

Table:

LOAD *,

  WeekDay(FlagDate) as Day,

  WeekDay(FlagDate1) as Day1;

LOAD *,

  WeekEnd(YearEnd(AddYears(Date, 1)) - 23) as FlagDate,

  WeekStart(YearEnd(AddYears(Date, 1)) - 17, 0, 3) as FlagDate1;

LOAD Date(MakeDate(2013, 1, 1) + RecNo() - 1) as Date

AutoGenerate MakeDate(2030, 1, 1) - MakeDate(2013,1,1);

FlagDate is Sunday

FlagDate1 is Thursday

alec1982
Specialist II
Specialist II
Author

works just perfect! thanks again!