Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
danielle_v
Creator
Creator

Previous Fiscal Year

Hi All,

I am doing some analysis using a fiscal calendar where the years are formatted as 2013/2014, 2014/2015 etc. These have been loaded into the script using the dual function, so each fiscal year also has a numeric value.

The problem I'm facing is that I need to create variables for current and previous year. The current year variable (=Fiscal_Year) works fine, and correctly returns the year formatted as yyyy/yyyy in a textbox. However, I'm struggling to get the previous year variable to work in the same way. I've set the variable as =Fiscal_Year-1, this returns the correct numeric value for the fical year, but I can;t get it to return in the text box in the required yyyy/yyyy format. I've tried adding text() around the statement, but to no avail.

Any help greatly appreicated!

1 Solution

Accepted Solutions
c_gilbert
Creator II
Creator II

This is the code we use:

vPreviousFiscalYear:

=num(left(MaxString(Year_Fiscal),4)-1)&'-'&num(right(MaxString(Year_Fiscal),2)-1,'00')

View solution in original post

2 Replies
c_gilbert
Creator II
Creator II

This is the code we use:

vPreviousFiscalYear:

=num(left(MaxString(Year_Fiscal),4)-1)&'-'&num(right(MaxString(Year_Fiscal),2)-1,'00')

danielle_v
Creator
Creator
Author

Many thanks Charlotte, this has done the trick perfectly 🙂