Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld starts MONDAY! last chance to register is now ! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jjustingkm
Contributor III
Contributor III

YTD based on input date

Can we calculate FYTD based on an input date. for example, if select 3/31 , then the data should be displayed YTD through 3/31.

4 Replies
rwunderlich

Here is an expression that will work in most cases:

Sum({<Year=, Month=, OrderDate = {"=InYearToDate(Only({1}OrderDate), Max(TOTAL OrderDate), 0, 1)"}>} LineSalesAmount) 

Make sure you ignore any other calendar selections as I have here (Year=, Month=) if that is how you are selecting dates.  If you are just selecting "OrderDate" then you don't have to worry about those other fields. 

If your FY starts on other than month 1, change the "1" at the end to the month (eg 8).

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

jjustingkm
Contributor III
Contributor III
Author

Thanks for the reply Rob. I am looking for  a filter based on the master calendar , for example , if select March 2021 , all the data in the  dashboard should be filtered based on this selection.

rwunderlich

The above should work. Substitute OrderDate for whatever your date field is named in the Calendar.

-Rob

jjustingkm
Contributor III
Contributor III
Author

I assume you are talking about filtering metrics expression  based on the date .

In my case If I select input parameter Mar 2021, all data in dashboard should be filtered FYTD through March.

I have implemented an FYTD indicator in load script based on current date and it is working fine but there I cant change that YTD dynamically .  It will always be based on current date. That means in my filter, if I select 2020 and 2021, it selects data till Mar 12th (todays date) for 2020 and 2021.