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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
linnea_sc
Contributor II
Contributor II

Autogenerate: generate count is out of range

Hi,

I'm having an issue with my master calendar. It's worked previously but we've recently made some changes to our databases and it now returns this error during load:

The following error occurred:
Autogenerate: generate count is out of range
 
The error occurred here:
LOAD Date#(FieldValue ('Date', RecNo ()), 'M/D/YYYY') as Date AutoGenerate FieldValueCount ('Date')
 
The date format has not changed, it's MM/DD/YYYY 00:00:00.
 
The master calendar script is:
 
"Master calendar":
LOAD
Dual(Year(Date), YearStart(Date)) AS [Year],
Dual('Q'&Num(Ceil(Num(Month(Date))/3)),Num(Ceil(NUM(Month(Date))/3),00)) AS [Quarter],
Dual(Year(Date)&'-Q'&Num(Ceil(Num(Month(Date))/3)),QuarterStart(Date)) AS [YearQuarter],
Dual('Q'&Num(Ceil(Num(Month(Date))/3)),QuarterStart(Date)) AS [_YearQuarter],
Month(Date) AS [Month],
Dual(Year(Date)&'-'&Month(Date), monthstart(Date)) AS [YearMonth],
Dual(Month(Date), monthstart(Date)) AS [_YearMonth],
Dual('W'&Num(Week(Date),00), Num(Week(Date),00)) AS [Week],
Dual(WeekYear(Date)&'-W'&Num (Week(Date), '00'), weekstart(Date)) AS [YearWeek],
Date(Floor(Date)) AS [Date],
Date(Floor(Date), 'D') AS [_Date],
If (DayNumberOfYear(Date) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,
Year(Today())-Year(Date) AS [YearsAgo] ,
If (DayNumberOfQuarter(Date) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,
4*Year(Today())+Ceil(Month(Today())/3)-4*Year(Date)-Ceil(Month(Date)/3) AS [QuartersAgo] ,
Ceil(Month(Today())/3)-Ceil(Month(Date)/3) AS [QuarterRelNo] ,
If(Day(Date)<=Day(Today()),1,0) AS [InMTD] ,
12*Year(Today())+Month(Today())-12*Year(Date)-Month(Date) AS [MonthsAgo] ,
Month(Today())-Month(Date) AS [MonthRelNo] ,
If(WeekDay(Date)<=WeekDay(Today()),1,0) AS [InWTD] ,
(WeekStart(Today())-WeekStart(Date))/7 AS [WeeksAgo] ,
Week(Today())-Week(Date) AS [WeekRelNo];
LOAD Date#(FieldValue ('Date', RecNo ()), '$(DateFormat)') as Date
AutoGenerate FieldValueCount ('Date');
 
What's going wrong here?
Labels (2)
2 Replies
Jaggu
Contributor
Contributor

Or
MVP
MVP

Is there actually a Date field being loaded prior to this statement? This error most commonly occurs when trying to Autogenerate a non-numeric (or negative) number of values, e.g.

Load 1 as Field

Autogenerate FieldValueCount('ThisFieldDoesNotExist');

Or_0-1684229486770.png

You could work around it by using alt(FieldValueCount('Date'),0) instead, which will autogenerate 0 rows if Date is missing (but at least it won't crash).