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

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

Year To Date Function

Hello everyone!

I have an issue with the YTD expression. In my app the calendar I've created starts from the first date it finds data.

Cattura.PNG

In this example, I have no data in my dataset before the 10th of January.

But if I use the YTD expression (date_field = {">=$(=Date(AddYears(Min([date_field]),-1)))<=$(=Date(AddYears(Max([date_field]),-1)))"}) 

my expression shows data starting from the 10th of January 2021 loosing the informations of the previous days.

I've tried to add the function YearStart() but if I select another range time it calculates data always starting from the first of Jan.

 

How can I solve this issue?

Thanks to all!

Labels (1)
3 Replies
sidhiq91
Specialist II
Specialist II

@danimarc12  will something like below expression help:

Date={‘>=$(=YearStart(Today()))<=$(=Today())’}>} 

Let me know if it does.

danimarc12
Partner - Creator
Partner - Creator
Author

Hi @sidhiq91 and thanks for your aswer.

As I said, if I use the YearStart() function, I can't compare different periods like March 2022 over March 2021.

rwunderlich
MVP
MVP

Add a MonthStart function. 

Date(MonthStart(AddYears(Min([date_field]),-1)))

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