Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

understanding the 'better calendar script'

Hi

Reference the very good blog post here:

http://qlikviewcookbook.com/2015/05/better-calendar-scripts/

I was testing the initial part of the load and getting a result I dont understand.

This is what I am loading:

LOAD

     min(fieldvalue('Order Header Invoice Date',recno()))-1    as mindate

    ,max(fieldvalue('Order Header Invoice Date',recno()))     as maxdate

AUTOGENERATE

    fieldvaluecount('Order Header Invoice Date')

;

Of the 591 distinct dates in the 'Order Header Invoice Date' it returns mindate as one less than the first date in the 'Order Header Invoice Date' which is correct; however the maxdate value is simply '?'

Is this monday morning stupidity (again) or has something gone wrong or been lost in translation

Thanks

Oli

1 Solution

Accepted Solutions
Kushal_Chawda

try to apply Num or Date function

num(min(fieldvalue('Order Header Invoice Date',recno()))-1)    as mindate

,num(max(fieldvalue('Order Header Invoice Date',recno())))     as maxdate

View solution in original post

3 Replies
Kushal_Chawda

try to apply Num or Date function

num(min(fieldvalue('Order Header Invoice Date',recno()))-1)    as mindate

,num(max(fieldvalue('Order Header Invoice Date',recno())))     as maxdate

Gysbert_Wassenaar

It's not a monday morning stupidity. It's something can happen with formatted dates. You could try adding a num around it:   ,num(max(fieldvalue('Order Header Invoice Date',recno())))     as maxdate


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you both of you.  I have just started to become smarter to the date related 'gotchas'.  I can now add this one to that list.

apologies gwassenaar that I cant mark more than one correct answer and as kush141087 piped you to post I have marked your anwser as helpful.  Cheers anyway