# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
5 Replies
Contributor II

## Re: Fiscal year YTD

Hi, Michael
try this

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
Highlighted
New Contributor III

## Re: Fiscal year YTD

Hi ZZ,

Thank you, it works fine.

Best, Michael

New Contributor

## Re: Fiscal year YTD

I have a Fiscal year PNL problem that I require help with.

My Fiscal Year ends the 6th Apr.

I need to SUM PNL for the Fiscal Year to date.

e.g. If 5th Apr selected, it would sum all PNL up to that date.

But once the 6th Apr is selected I want to not include anything prior to it.

Any help would be much appreciated.