Skip to main content
Announcements
Get Ready. A New Qlik Learning Experience is Coming February 17! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
notlohdahc
Contributor II
Contributor II

Year Expression Returning Null

I'm in QlikView not QlikSense if that makes a difference . .

This statement is working for all dates prior to 01/01/2025, but all dates in 2025 are returning a null value.  Why? 

 

Year(YearStart(OpenOrdDateSchedShip)) as [OpenOrd Date Sched Ship Year]

 

notlohdahc_0-1736532342912.png

 

Labels (2)
1 Solution

Accepted Solutions
notlohdahc
Contributor II
Contributor II
Author

I found the problem.  It was further upstream in the script.  it's hard to explain . . . We have a variable that is supposed to hold the current date.  For some reason that date was getting set to 03/10/2025 and not 01/10/2025. This caused schedship dates in 2025 and beyond to not be considered valid dates.  After fixing this variable, dates are being recognized as valid

 

I personally do not understand why this variable caused the SchedShip dates to come up as null.  But fixing it fixed my issue. 

notlohdahc_0-1736775594149.png

 

    

View solution in original post

5 Replies
eddyvargas
Contributor III
Contributor III

Check if your script has:

SET DateFormat='MM/DD/YYYY';

 

Is not necessary YearStart, only Year(OpenOrdDateSchedShip)

Vegar
MVP
MVP

Both Year(YearStart(OpenOrdDateSchedShip)) and the suggested Year(OpenOrdDateSchedShip) should work.

 

I'm guessing here, but could it be that you don't have the dates for 2025 in the table where you are defining [OpenOrd Date Sched Ship Year]? And the values with null are actually missing. 

This is only a valid guess if OpenOrdDateSchedShip i a key field between that table and another table that do contain 2025 date values.

Or
MVP
MVP

When date and time fields stop working, the first thing to do is confirm that the field is actually being treated as a date. You can confirm this by using Num(FieldName) to see if you get a numeric result matching the date.

Bhushan_Mahajan
Contributor III
Contributor III

@notlohdahc Please check the format of Date in Qlik as well as your source.

notlohdahc
Contributor II
Contributor II
Author

I found the problem.  It was further upstream in the script.  it's hard to explain . . . We have a variable that is supposed to hold the current date.  For some reason that date was getting set to 03/10/2025 and not 01/10/2025. This caused schedship dates in 2025 and beyond to not be considered valid dates.  After fixing this variable, dates are being recognized as valid

 

I personally do not understand why this variable caused the SchedShip dates to come up as null.  But fixing it fixed my issue. 

notlohdahc_0-1736775594149.png