Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
QlikSensor
Partner - Creator
Partner - Creator

Need the fiscal year as a variable

Hi,

I need the fiscal year as a variable during load. The data load is exectured on a daily basis via a daily trigger. 

I need this to setup an if statement in different diagrams.

Thanks for supporting.

4 Replies
JordyWegman
Partner - Master
Partner - Master

Hi,

Because fiscal years are company dependent, you will need to have this information in your calendar.

If you have this calendar you can extract this:

Calendar:
Load
  [Fiscal year]
From [YourSource] (qvd)
Where %Date = floor(today());  // Assumption is that you have a floored date

Let vCurrentFiscalYear = Peek('Fiscal year',0,'Calendar')

 

Now you have your variable vCurrentFiscalYear.

Jordy

Climber

Work smarter, not harder
QlikSensor
Partner - Creator
Partner - Creator
Author

Hm,

I haven't this calendar. Our fy starts on 1.10.

I would need for today 2019 and on 1.10.2019 2020. Can't this be done more easily during load?

JordyWegman
Partner - Master
Partner - Master

Yes this is possible of course, use this formula:

if(date(Date,'MMDD')&'' >= 1001 & '' and date(Date,'MMDD')&'' <= 1231 & '' ,Year(Date) + 1,Year(Date))	as [Fiscal year],

Jordy

Climber 

Work smarter, not harder
jonathandienst
Partner - Champion III
Partner - Champion III

Or simpler:

Year(AddMonths(Date, 3)) as [Fiscal Year],
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein