Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Year is pulling individual day

Hi All,

I am using the following script to load a timestamp as its correct year and date:

Left Join

LOAD DATE ([ContractStartDate],'MM/DD/YYYY') AS ContractStartDate

          ,DATE([ContractStartDate],'YYYY') AS ContractStartYear

          ,DATE([ContractStartDate],'MM') AS ContractStartMonth

However, when I show the ContractStartYear as a list, it returns the same year multiple times, and even though each one looks the same, they actually pull a single day's worth of data, not the whole year.

Example:

ContractStartYear

2001  <--only refers to 01/05/2001

2001  <--only refers to 05/04/2001

2001  <--only refers to 07/12/2001    etc...

2001

2002

2002

Is there something I need to specify in the script so that it will instead yield the following:

ContractStartYear

2001  <--refers to entire year of 2001

2002  <--refers to entire year of 2002  etc...

Thanks!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You only changed the format of your dates to show only the year, but the date is still kept in the numerical representation.

Use year(DATEFIELD) instead to create a year field.

View solution in original post

2 Replies
swuehl
MVP
MVP

You only changed the format of your dates to show only the year, but the date is still kept in the numerical representation.

Use year(DATEFIELD) instead to create a year field.

Not applicable
Author

Thanks!!