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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Error while generating days between start date and End date

Hi Guru's,

i have script like this

LET Start = num(makedate(2008,1,1));

let End=num((Asof);

LET NumOfDays = End - Start + 1;

Date_src:

LOAD

  $(Start) + RowNo() - 1 AS DateNum

  ,Date($(Start) + RowNo() - 1) AS Date

AUTOGENERATE 1 

WHILE $(Start)+IterNo()-1<= $(End); 

start date is 2008 Manually entered.

End date is coming from excel data .

iam geeting error as attached

please find the sample application

How to solve this

any help would be greately appreciated

thanks in advance

1 Solution

Accepted Solutions
MarcoWedel

Hi,

another solution could be:

tabCalendar:

LOAD *,

    Day(Date) as Day,

    WeekDay(Date) as WeekDay,

    Week(Date) as Week,

    WeekName(Date) as WeekName,

    Month(Date) as Month,

    MonthName(Date) as MonthName,

    Dual('Q'&Ceil(Month(Date)/3),Ceil(Month(Date)/3)) as Quarter,

    QuarterName(Date) as QuarterName,

    Year(Date) as Year,

    WeekYear(Date) as WeekYear;  

LOAD Date(MinDate+IterNo()-1) as Date

While MinDate+IterNo()-1 <= MaxDate;

LOAD MakeDate(2008,1,1) as MinDate,

    Max(Asof) as MaxDate

Resident Res;

hope this helps

regards

Marco

View solution in original post

13 Replies
sunny_talwar

raj babu wrote:

Hi Guru's,

i have script like this

LET Start = num(makedate(2008,1,1));

let End=num((Asof);

LET NumOfDays = End - Start + 1;

Date_src:

LOAD

  $(Start) + RowNo() - 1 AS DateNum

  ,Date($(Start) + RowNo() - 1) AS Date

AUTOGENERATE 1

WHILE $(Start)+IterNo()-1<= $(End);

End seems to have an extra parenthesis. Where is Asof coming from here? another table?? You might need to use Peek function here

Not applicable
Author

End is coming from excel file its another table.

peek () how to use in this scenario

Asof Field Contains only one Date Column.

Please find Attached

sunny_talwar

Does columne Asof contain only one value?? If it does than you can try this may be:

LET End=Peek('Asof');

Not applicable
Author

No luck Sunny.

Thanks for your Time

sunny_talwar

What about this:

LET End=Num(Peek('Asof'));

Not applicable
Author

Tried but no luck

its not recognizing End date, while reloading its throwing erorr

sunny_talwar

Can you post the script for the table where you are bringing in Asof field from the excel file?

Not applicable
Author

Hi here is the script

head:

LOAD

if(not match ([Job Posting Title],'The data contained in this report is as of 06/03/2015 01:46 PM EDT'),[Job Posting Title]) as [Job Posting Title],

if(match([Job Posting Title],'The data contained in this report is as of 06/03/2015 01:46 PM EDT'), [Job Posting Title] )as Test,

     [Worker: Worker Supervisor],

     Worker,

     [Worker ID],

     Status,

     [Start Date],

     [End Date],

     "Current Bill Rate [ST/Hr]",

     [Physical Location of Worker],

     [Worker Closed Date],

     [Cumulative Committed Spend],

     [Total Spend]

  

FROM

(biff, embedded labels, header is 1 lines, table is Headcount$);

Res:

load *,

Mid(if(wildmatch(Test,'**/**/**') ,Test),44,10) as Asof

resident head;

drop table head;

sunny_talwar

Seems like your Asof is not read as a date.

Try this:

head:

LOAD

// Mid(if(wildmatch(if(not match ([Job Posting Title],'The data contained in this report is as of 06/03/2015 01:46 PM EDT'),[Job Posting Title]),'**/**/**') ,[Total Spend]),7,10) as Asof

if(not match ([Job Posting Title],'The data contained in this report is as of 06/03/2015 01:46 PM EDT'),[Job Posting Title]) as [Job Posting Title],

if(match([Job Posting Title],'The data contained in this report is as of 06/03/2015 01:46 PM EDT'), [Job Posting Title] )as Test,

    [Worker: Worker Supervisor],

    Worker,

    [Worker ID],

    Status,

    [Start Date],

    [End Date],

    "Current Bill Rate [ST/Hr]",

    [Physical Location of Worker],

    [Worker Closed Date],

    [Cumulative Committed Spend],

    [Total Spend]

    // Mid(if(wildmatch([Total Spend],'**/**/**') ,[Total Spend]),7,10) as Asof

FROM

(biff, embedded labels, header is 1 lines, table is Headcount$);

Res:

load *,

Date#(Mid(if(wildmatch(Test,'**/**/**') ,Test),44,10), 'MM/DD/YYYY') as Asof //ASSUMING MM/DD/YYYY FORMAT

resident head;

drop table head;

and then the variable:

LET End=Num(Peek('Asof'));