Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
berryandcherry6
Creator III
Creator III

Error : year field not found in Load script

Hi all,

i am trying to execute/Load below code in script but it gives me 'year field not found'  error

From below code i am trying to get previous year Weekend_Group_Year.

LOAD

    date(WeekEnd(CanonicalDate), 'MM-DD-YY')  as Weekend_Group_Year

    RESIDENT DateBridge WHERE Date(CanonicalDate, 'YYYY') =  $(= max(Year-1));

Why is this giving me this error, if   year  is a function

Please help me on this.

4 Replies
Chanty4u
MVP
MVP

what is ur date format?

Clever_Anjos
Employee
Employee

You should calculate first the max year

LOAD

    Max(Year) as m

Resident yourtable;

LET M=Peek('m');

LOAD

    date(WeekEnd(CanonicalDate), 'MM-DD-YY')  as Weekend_Group_Year

    RESIDENT DateBridge WHERE Date(CanonicalDate, 'YYYY') =  $(M);

Anonymous
Not applicable

Hi

  has the field 'Year'  found in the table  DateBridge  ?

otherwise you have to try like this ..

LOAD

    date(WeekEnd(CanonicalDate), 'MM-DD-YY')  as Weekend_Group_Year

    RESIDENT DateBridge

    WHERE Date(CanonicalDate, 'YYYY') =  $(= max(Year((CanonicalDate))-1));

berryandcherry6
Creator III
Creator III
Author

hi,

Yes year is found in datebridge