Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
stevelord
Specialist
Specialist

Why Today() is better than Now() on front end expressions

So I have this nprinting project where I want nprinting to be able to just cycle through clients and grab numbers at face value.  I am writing expressions in qlikview that look at activity through the end of 'last month'.

I'm used to using now() on load scripts where I want to filter out (or isolate) stuff with erroneous dates from the future, but using now() on front end expressions kept my CPU running at 99-100% and the little calculation bars kept flickering up and down my numbers without changing the numbers.  It dawned on me that this expression was recomputing now() as fast as the timestamp for now() changed.

=count(distinct if(

((date(floor([PSQ Completed Date])))>=(date(floor(CurrentPYStart))))

AND

((year([PSQ Completed Date])&num(month([PSQ Completed Date]),'00'))<(year(Now())&num(month(Now()),'00')))//through last month

,UserId))

I resolved by switching from now() to today() - the nonstop recalculation halted after one quick calculation for today().

=count(distinct if(

((date(floor([PSQ Completed Date])))>=(date(floor(CurrentPYStart))))

AND

((year([PSQ Completed Date])&num(month([PSQ Completed Date]),'00'))<(year(Today())&num(month(Today()),'00')))//through last month

,UserId))

Just wanted to share in case anyone else had such an issue.  It's invisible on small sets of test data I had, but was frightening with large sets of data. Couple hours of my life I'd like back.

(These formulas are among 20 or so designed to just produce final counts of various things, and I have nprinting placing them on a raw data tab of an excel spreadsheet.  Another finished graphic/design heavy tab of the excel file takes in the raw data and we save that finished page as a pdf.  QV and Nprinting are awesome, but reporting people liked the graph designs from ms office and such a little more, so I just get numbers onto their files for them. )

2 Replies
Anonymous
Not applicable

Today is the one date which does not take much of a time whether you write it in the back end or front end. However, when you use Now(), it calculates the real time and provides the output. While calculating, it take the maximum CPU memory. Ho[e this helps.

Anonymous
Not applicable

If you want to have real time 21:17 PM  value then probably you don't have any option but if your requirement is to have today's date then today() is the best function to use.