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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

InYearToDate requires application to be closed and reopened

I have a dual purpose application, which creates daily qvds and also has few dashboards.

Recently I was validating the dashboards and saw a difference in sales figures for two charts for 2013 sales

The difference in expression was , once uses InYearToDate and other uses InYear

  • sum(if(Trans_Type = 'Sales'   and STATUS = 'Complete' AND APPROVED_FLG ='Y',(if(InYearToDate(ORDER_DATE, (today()),0), SALES_AMT)),0))

  • sum(if(Trans_Type = 'Sales'  AND STATUS = 'Complete' AND APPROVED_FLG ='Y',(if(InYear(ORDER_DATE, (today()),0), SALES_AMT)),0))

What I noticed is if I do not close the application and reopened the "today" remains the original application date.

Does anyone know whether this is an expected behavior ? if so is there any workaround?

Thanks,

Aji Paul

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Please check the timer modes for today() function. Default timer mode is 2, which means today() returns the date when the application was opened.

So your InYearToDate() function returns true if ORDER_DATE lies between this year's start and the date you opened the application (assuming you opened the application this year), while your InYear() function returns true for all ORDER_DATEs of this year (again assuming you opened the application this year).

Is this what you see? Then I think it is expected behaviour. A workaround or fix depends on what you expect to see instead.

View solution in original post

3 Replies
phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

Dont know what's causing the issue. Perhaps a sample qvw will help..

Have you tried using "date(Now())" instead of "Today()".

--Phani

swuehl
MVP
MVP

Please check the timer modes for today() function. Default timer mode is 2, which means today() returns the date when the application was opened.

So your InYearToDate() function returns true if ORDER_DATE lies between this year's start and the date you opened the application (assuming you opened the application this year), while your InYear() function returns true for all ORDER_DATEs of this year (again assuming you opened the application this year).

Is this what you see? Then I think it is expected behaviour. A workaround or fix depends on what you expect to see instead.

Not applicable
Author

Thanks that explains! I did not know that  today()'s   default timer mode is 2.

From what I understand Now() has the default timer mode 1 so that should work.

Thanks swuehl & Phaneendra Kunche !