Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create calendar table that defines pay schedule

Is there a way to create a calendar table that defines the pay schedule?

We get paid every 2 weeks, but the specific pay date is not recorded in our system.

So say today is the day everyone gets their check. Today's Check (02/17/2012) includes the dates 01/30/2012 - 02/12/2012

I want to create a master calendar that I can tie into ours time ticket table that will allow me to group the correct dates into each pay schedule.

Is something like this possible?

11 Replies
Not applicable
Author

Here is the calendar code I am using:

Calendar: 

LET vDateMin = Num(MakeDate(2010,1,1)); 

LET vDateMax = Floor(MonthEnd(Today())); 

LET vDateToday = Num(Today()); 

LET PD = Date(makedate(2010,1,08));

TempCalendar: 

Left Keep (PayCore)

LOAD

$(vDateMin) + RowNo() - 1 AS DateNumber, 

Date($(vDateMin) + RowNo() - 1) AS TempDate 

AUTOGENERATE 1 

WHILE $(vDateMin)+IterNo()-1<= $(vDateMax); 

Calendar: 

LOAD

Date(TempDate) AS CalendarDate, 

Date(TempDate) AS  calendarlink,

if(mod(floor(TempDate)-'$(PD)',14)=0,TempDate) as PayDay,

// Standard Date Objects

Day(TempDate) AS CalendarDayOfMonth, 

WeekDay(TempDate) AS CalendarDayName, 

Week(TempDate) AS CalendarWeekOfYear, 

Month(TempDate) AS CalendarMonthName, 

'Q' & Ceil(Month(TempDate)/3) AS CalendarQuarter, 

Year(TempDate) AS CalendarYear, 

// Calendar Date Names 

WeekName(TempDate) as CalendarWeekNumberAndYear, 

MonthName(TempDate) as CalendarMonthAndYear, 

QuarterName(TempDate) as CalendarQuarterMonthsAndYear, 

// Start Dates 

DayStart(TempDate) as CalendarDayStart, 

WeekStart(TempDate) as CalendarWeekStart, 

MonthStart(TempDate) as CalendarMonthStart, 

QuarterStart(TempDate) as CalendarQuarterStart, 

YearStart(TempDate) as CalendarYearStart, 

// End Dates 

DayEnd(TempDate) as CalendarDayEnd, 

WeekEnd(TempDate) as CalendarWeekEnd, 

MonthEnd(TempDate) as CalendarMonthEnd, 

QuarterEnd(TempDate) as CalendarQuarterEnd, 

YearEnd(TempDate) as CalendarYearEnd, 

// Combo Date Examples 

'Q' & Ceil(Month(TempDate)/3) & '/' & Year(TempDate) AS CalendarQuarterAndYear, 

Year(TempDate) & '/' & 'Q' & Ceil(Month(TempDate)/3) AS CalendarYearAndQuarter, 

'Wed ' & DayStart(WeekStart(TempDate) + 3) as CalendarWednesdays 

RESIDENT TempCalendar ORDER BY TempDate ASC; 

DROP TABLE TempCalendar; 

LET vDateMin = Num(MakeDate(2010,1,1)); 

LET vDateMax = Floor(YearEnd(AddMonths(Today(), 12))); 

LET vDateToday = Num(Today()); 

Anonymous
Not applicable
Author

I see, it's not what I thought...  You want a value of payday for each date, and the rules are according to your example.  If I got the requirement right this time, here it is:

=if(mod(date(floor(weekend(Date))) -2- $(PD), 14)=0,
date(floor(weekend(Date)+12)),
date(floor(weekend(Date)+5)))

I tried it in a calculated list box.  Can work as in expression in the chart or in the script, as an additional field in the master calendar.

Regards,

Michael