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: 
Not applicable

Variable to give me Current Financial Year -1

I need to create a variable which will hold the current selected Financial Year - 1

I have a variable to hold the current Financial Year  =if(isnull(FinancialYear),yearname(today(), 0, 4 ), FinancialYear)

However I cant seem to find one which will give me the current selected FY - 1

The following does not work -=if(isnull(FinancialYear),yearname(addyears(today(),-1),0,4), vCurrentFY )

Anyone have any ideas?

Many Thanks

1 Solution

Accepted Solutions
Not applicable
Author

I used the following varible to the result... there may be an easier way to do it!

=yearname(if(isnull(FinancialYear),yearname(today(), 0, 4 ), FinancialYear), 0, - 4 )

View solution in original post

7 Replies
Not applicable
Author

See attached. It takes the max year (either max selected if a year is selected or max of all data if no selection is made) and subtracts one year.

Not applicable
Author

Thanks for the post, however I need [Financial Year] and not Year

My [Financial Year] field = yearname (Date, 0, 4 )  as FinancialYear,

When I create the variable - max(FinancialYear) the output is '41000'

whiteline
Master II
Master II

When I create the variable - max(FinancialYear) the output is '41000'

Hi

Just change the format with date() function.

Not applicable
Author

yearname(today(), 0, - 4 ) which will give you the current selected FY - 1.Is this You want

Not applicable
Author

I already have the current selected FY  =yearname(today(), 0, 4 )

I need the current selected FY -1

So if I select '2012-2013', I need the variable to read '2011-2012'

And if I select '2011-2012' I need '2010-2011', etc...

This peice of code only gives me the last FY, regardless of my current selection

Thanks

Not applicable
Author

Please Find Attached the Document

Not applicable
Author

I used the following varible to the result... there may be an easier way to do it!

=yearname(if(isnull(FinancialYear),yearname(today(), 0, 4 ), FinancialYear), 0, - 4 )