Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_Chappell
Contributor III
Contributor III

Help with YTD

Good Morning Everyone,

We seem to be having an issue with our YTD set analysis since the beginning of 2021. I'm assuming that given the way our data load/expression has been written that it's not looking passed the current date - in the past. We're just unsure on how to correct it.

For example; when setting a filter of Oct-Dec, 2020, the Sales for all Customers show as a '0' due to us not being in Q4 in 2021. 

YTD in script;
IF( DayNumberOfYear([Date]) <= DayNumberOfYear(Today()-1) AND
[Date] <= Today()-1, 'Y', Null() ) AS IsYTD,

Expression;
Sum( {<IsYTD = {'Y'}, InvoiceYear = {$(=Max(InvoiceYear))}>} GrossSales)

Any help would be much appreciated.

Michael 

Labels (4)
1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi ,

your IsTYD flag is good for this year and for comparing this year to different years 
you can create a different flag to use in your expression 

IF( [Date] <= Today()-1, 'Y', Null() ) AS IsPastDate,

View solution in original post

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hi ,

your IsTYD flag is good for this year and for comparing this year to different years 
you can create a different flag to use in your expression 

IF( [Date] <= Today()-1, 'Y', Null() ) AS IsPastDate,

Michael_Chappell
Contributor III
Contributor III
Author

Hi,

 

Thank you for your answer, and for your swift reply. This flag works perfectly.

 

All the best,

Michael