Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Prob regarding Script

Hey,

In my script i am writing :

subfield(YearStart(floor(CreateDate) , 0 , 11) , '-' , 1) + 1 as [Fiscal Year] ;

Now let say i have values of Create Date as:

01-01-2015 , 14-04-2015 , 08-011-2015.

THen for every date above , it will give same result i.e  01-011-2015 and fiscal year as 2016.

ISn't this wrong??

THanks

3 Replies
Gysbert_Wassenaar

If you want to calculate fiscal years perhaps this blog post helps: Fiscal Year


talk is cheap, supply exceeds demand
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Works for me (except replacing the SubField with Year):

LOAD CrDate,

  YearStart(CrDate, 0, 11) As YS,

  Year(YearStart(CrDate, 0, 11)) As YY

Inline

[

  CrDate

  01-01-2015

  14-04-2015

  08-11-2015

];

FY.png

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
nikhilgarg
Specialist II
Specialist II
Author

Hey,

THankx but my doubt was:

LEt say date field as in ur case is:

01-01-2015 , then YS would be 01-11-2014 or 01-11-2015 ?? becoz as per syntax of YearStart() , if shift = 0 then then date year is taken with month as indicated. Plz clear.

thanks