Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
jjustingkm
Creator
Creator

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
Partner Ambassador/MVP
Partner Ambassador/MVP

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
Creator
Creator
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
Partner Ambassador/MVP
Partner Ambassador/MVP

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

-Rob

jjustingkm
Creator
Creator
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.