Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

calculate Vacation days

i am going to maintain Vacation Maintanace report

in my table I have only present date only

how to calulate leave days

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Create a calendar table with automate script based on the least date and max date.

Example

TempMinDate:

LOAD

    Min(Date) AS MinDate

RESIDENT TableName;

LET vDateMin = FieldValue('MinDate', 1);

LET vTodayNum = Num(Today());

DROP TABLE TempMinDate;

SalesDates:

LOAD

    ($(vDateMin) + (RecNo()) - 1)  AS Date,

    RecNo() AS DateRecNo  

AUTOGENERATE ($(vTodayNum) - $(vDateMin) + 1);

Anonymous
Not applicable
Author

I Have Table like this

ID      PresentDATE

1          12/2/2013

2          12/2/2013

1          13/2/2013

1          14/2/2013

2          15/2/2013

i need to calculate leave days 

eddysanchez
Partner - Creator
Partner - Creator

with the next code

TempMinDate:

LOAD

    Min(PresentDATE) AS MinDate

RESIDENT TableName;

 

LET vDateMin = FieldValue('MinDate', 1);

LET vTodayNum = Num(Today());

 

DROP TABLE TempMinDate;

 

SalesDates:

LOAD

    num($(vDateMin) + (RecNo()) - 1)  AS DATE

AUTOGENERATE ($(vTodayNum) - $(vDateMin) + 1);

 

left join (SalesDates)

LOAD Distinct ID

Resident TableName;

You have the table SalesDate with all dates for each ID

and you can show or sum (depends or your requeriment) in your layout the leave days