Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to get Fiscal Year> YTD to work. When I attempt to apply the same logic I used to get YTD in Calendar Year it keeps returning calendar year YTD values.
What do I need to change this? Below is my code for calculating fiscal year. I have attempted to calculate my own YTD equations with in the code, but was not successful.
'master_date' is a value I share between both databases I am combining.
[Fiscal Calendar]:
LOAD date(date#(20011101,'YYYYMMDD')+recno(),'MM/DD/YY') AS "master_date"
AUTOGENERATE today()-date#(20011101,'YYYYMMDD')
;
LEFT JOIN ([Fiscal Calendar])
LOAD
"master_date",
date(monthstart(master_date),'MMM YY') AS "MonthFisical",
date(yearstart(master_date,1,11),'YYYY') AS "YearFiscal",
Year2Date(master_date) * -1 AS YTD_Flag_Fiscal, //attempt one
Year2Date(master_date,-1, 1, $(vToday))*-1 AS LY_YTD_Flag_Fiscal, //attempt two
YearToDate(master_date, -1, Year(Today(1))) AS Year_YTD_Fiscal //attempt three
RESIDENT [Fiscal Calendar]
;
Thanks for any help on this matter.
From the help text:
YearToDate( date [ , yearoffset [ , firstmonth [ , todaydate] ] ] )
So, if your fiscal year starts in April, for instance:
yeartodate(master_date, 0,4) as YTD_Flag_Fiscal,
yeartodate(master_date,-1,4) as LY_YTD_Flag_Fiscal,
That's how I read the help text, anyway.
From the help text:
YearToDate( date [ , yearoffset [ , firstmonth [ , todaydate] ] ] )
So, if your fiscal year starts in April, for instance:
yeartodate(master_date, 0,4) as YTD_Flag_Fiscal,
yeartodate(master_date,-1,4) as LY_YTD_Flag_Fiscal,
That's how I read the help text, anyway.
Just reading to much into it. Sometimes it is easier to just go back to the basics.
Thanks.