Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
ClickNorth
Contributor
Contributor

Fiscal year YTD Returns

Hi,

I am having an issue displaying YTD returns as my Fiscal Year begins the 6th Apr. 

I have a field that says FYTD Returns. I need this to calculate the returns from the beginning of the financial year to the Max value date selected. 

That is, any date after the 6th Apr 19 would start at the 6th of Apr 19 and sum returns to the max value date selected (up to the 6th Apr 2020). 

Anything prior to  6th Apr 19 would start at 6th Apr 18 and sum returns up to a max date of 6th Apr 19.

Any help would be much appreciated. 

Thanks,

SC

Labels (2)
3 Replies
dplr-rn
Partner - Master III
Partner - Master III

Do you have a master calendar?
i would say use one
https://qlikviewcookbook.com/2015/05/better-calendar-scripts/

and create a new column there which marks the fiscal year
e.g. roughcode
if (Month(OrderDate)<4, (Year(OrderDate)-1)&'-'&Year(OrderDate) // Jan-Mar
, if (Month(OrderDate)>4
, Year(OrderDate)&'-'&(Year(OrderDate)+1) // May-Dec
, if(Day(OrderDate)>=6, Year(OrderDate)&'-'&(Year(OrderDate)+1) //Apr 6 and above
,(Year(OrderDate)-1)&'-'&Year(OrderDate)) //Apr 1-5
)
) as FiscalYear

ClickNorth
Contributor
Contributor
Author

Thanks a million for the reply Dilipranjith. 

Unfortunately I am getting an error in the when trying load the master calendar script. 

It's saying 'autogenerate count out of bounds'. 

Could you advise if I could use the below coded variable (which I got from my colleague).

But instead of YearStart being the 1st of Jan, how could I make it 6th of April. 

Could I use MakeDate perhaps? 

Date Filter Variale

{<[Value Date]={">=$(=Date(YearStart(max([Value Date])))) <=$(=MAX([Value Date]))"}

Or is there any there way? 

Regards,

SC

 

 

 

 

 

dplr-rn
Partner - Master III
Partner - Master III

YearSTart is a qlik function. that will return always 1st Jan.