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: 
Not applicable

InYearToDate function gives wrong values

I have a really strange problem with the InYearToDate function. Given the following situation:

LET vCurrentDate = '31-03-2008 23:59:59';

When I do a sum(Sales) over the year 2008 (jan, feb, mar) I get as result: € 257.203,00 which is right.

When I do a sum(Sales) over the year 2007 (jan, feb, mar) I get as result: € 243.214,00 which is also right.

Next thing I want to do is a YearToDate function to compare with 2007 (jan, feb, mar). To sum 2007 and 2008 sales I use the following syntax:

to sum 2008:

Sum({1} IF(InYearToDate (Date, vCurrentDate , -0), Sales))

to sum 2007:

Sum({1} IF(InYearToDate (Date, vCurrentDate , -0), Sales))

The values I get back from those two functions are:

  • 2007: 246.031
  • 2008 514.215

I really don't know what's going wrong.. any sugestions?

Labels (1)
2 Replies
Not applicable
Author

Of course to sum 2007 should be:

Sum({1} IF(InYearToDate (Date, vCurrentDate , -1), Sales)

Not applicable
Author

Stupid mistake..... I forgot a field in my link table which caused the strange values.