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: 
balajisj30
Creator
Creator

Duplicate derived field

I am getting the below error, whenever i am loading data through data load editor.

qlik doubt.PNG

5 Replies
luismadriz
Specialist
Specialist

Hi,

You may be using autoCalendar: twice or going through a routine that uses Derive Fields without renaming it.

The only time I've seen this happening is when I created a subroutine to create mastercalendars passing parameters. The second time I passed through it it gave me that error. I corrected by making the name of the field declaration variable vAuto

Something like this:

// AutoCalendar

  Let vAuto = vDateFieldText & '_Auto';

  [$(vAuto)]:

  Declare Field Definition Tagged ('$date')

  Fields

    Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

    Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),

    If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,

    If (DayNumberOfYear($1,7) <= DayNumberOfYear(Today(),7), 1, 0) AS [InFYTD] ,

    If(Day($1)<=Day(Today()),1,0) AS [InMTD] ,

    Year(Today())-Year($1) AS [YearsAgo] ,

    12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,

    Month(Today())-Month($1) AS [MonthRelNo];

  Derive Fields from Fields $(vDateFieldName) Using [$(vAuto)];

Digvijay_Singh

Can you share your calendar script snippet, looks like something is wrong related to it.

Thanks,

balajisj30
Creator
Creator
Author

[autoCalendar]:

  DECLARE FIELD DEFINITION Tagged ('$date')

FIELDS

  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),

  Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

  Month($1) AS [Month] Tagged ('$month', '$cyclic'),

  Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

  Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),

  Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),

  Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),

  Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),

  If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,

  Year(Today())-Year($1) AS [YearsAgo] ,

  If (DayNumberOfQuarter($1) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,

  4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,

  Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,

  If(Day($1)<=Day(Today()),1,0) AS [InMTD] ,

  12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,

  Month(Today())-Month($1) AS [MonthRelNo] ,

  If(WeekDay($1)<=WeekDay(Today()),1,0) AS [InWTD] ,

  (WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,

  Week(Today())-Week($1) AS [WeekRelNo] ;

DERIVE FIELDS FROM FIELDS [eff date], [exp date] USING [autoCalendar] ;

luismadriz
Specialist
Specialist

Hi Balaji, where is INDI_DATE_OF_BIRTH? That's where the problem is happening

luismadriz
Specialist
Specialist

You have two options, either add INDI_DATE_OF_BIRTH to this script and delete the other, or rename [autoCalendar]: to something like [autoCalendar2]:


I hope this helps,

Luis