# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
New Contributor III

## Fiscal year YTD

Hi!

I have a fiscal calendar starting October 1. st.

How can I make a flag field which flags all dates in "YearToDate" for current and all previous years.

When I use this formula, it only flags the dates from 2018 October 1. to current day (2019 January 12.)

if(InYearToDate(Date,today(),0,10),1,0) as YTD

I want to flag all dates for October 1. to January 12, in all previous years in my calendar.

Whit my normal calendar I can do this with:

if (DayNumberOfYear(Date) <= DayNumberOfYear(Today()), 1, 0) as YTD

Any ideas?

Thanks

Michael

Labels (3)

• ### ytd

1 Solution

Accepted Solutions
Contributor II

## Re: Fiscal year YTD

Hi, Michael
Then try this

if(Date-if(Month(Date)>=10,MakeDate(Year(Date),10,1),MakeDate(Year(Date)-1,10,1)) <=
(Today()-if(Month(Today())>=10,MakeDate(Year(Today()),10,1),MakeDate(Year(Today())-1,10,1))),1,0
) as FYTD_Flag

Hope this helps
ZZ
4 Replies
Contributor II

## Re: Fiscal year YTD

Hi, Michael
try this
if(InYearToDate(Date,AddYears(today(),-1),0,10),1,0) as PYTD

Hope this helps
ZZ
New Contributor III

## Re: Fiscal year YTD

Hi ZZ,

Thanks, but it only flags the dates in previous fiscal year (dates from 2017 October 1.  to  2018 January 12.).

My calendar begins in 1999, and for each fiscal year, I want to flag the dates from October 1. to  January 12. (= ToDay() ).

Best

Michael

Contributor II

## Re: Fiscal year YTD

Hi, Michael
Then try this

if(Date-if(Month(Date)>=10,MakeDate(Year(Date),10,1),MakeDate(Year(Date)-1,10,1)) <=
(Today()-if(Month(Today())>=10,MakeDate(Year(Today()),10,1),MakeDate(Year(Today())-1,10,1))),1,0
) as FYTD_Flag

Hope this helps
ZZ
New Contributor III

## Re: Fiscal year YTD

Hi ZZ,

Thank you, it works fine.

Best, Michael