Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum values between two dates

Hi All

I want to show sum the values falling between two dates in a textbox . Below are the steps which i followed so far

  1. Created a variable in settings -> variable overview named them as venddate and vstartdate
  2. Added the below expression in text box but its not working 

          =Sum({$<closeDate = {">=$(venddate) <=$(vEndDate) "}>} sales)

Can anyone help me on to correct the syntax

Many thanks

Ashish

19 Replies
Not applicable
Author

its mm/dd/yyyy

in varibes

i m using today() and makedate function to create date

Not applicable
Author

use today() function in a text box and verify that the date format in closeDate field matches the date format of Today(). Secondly also make sure that the date format in vStartDate is mm/dd/yyyy

Not applicable
Author

its showing correct  10/26/2013

swuehl
MVP
MVP

Have you tried what I suggested above, evaluating the QV functions in the variable definition?

See also:

Not all variables are created equal » The Qlik Fix! The Qlik Fix

Not applicable
Author

hi

I tried almost all the options but its still showing zero but if i pass dates like below

=(sum( {$<closedate = {">=1/1/2012 <=6/1/2012"} >} Sales))

it works fine

tresesco
MVP
MVP

andrewpettit
Partner - Creator
Partner - Creator

I believe the issue is the dollar-sign expansion is returning the date string but you are trying to perform a numeric range search.  I have noticed before that it seems sometimes QlikView evaluates text search you might be able to make on list boxes and searches you can specify in Set Analysis differently.

Try the following:

=Sum({$<closeDate = {">=$(#venddate) <=$(#vEndDate) "}>} sales)


The dollar-sign pound should force the dollar-sign expansion to return the numeric value of the dual valued date which has both a string value and number value.

preminqlik
Specialist II
Specialist II

hey ashish try this then,

sum(if(closedate>=vStartDate and closedate<=vEndDate,Sales))

i think u'l take calendar object fo both startdate and end date, in both objects, assign these following values to its range

min= min({1}Date(CloseDate))

max=date(reloadtime())

hope this helps you

Not applicable
Author

try this

for a given day to any number of day. here i have taken n=14 day

Sum

({$<Date_id = {">=$(=(Date_id))<=$(=(date(num(Date_id)+14)))"}>} [field])

Not applicable
Author

Hi all,

I am getting the same, value as 0.

My expression is

Sum({$<Date = {">=$(#vStartDate1) <=$(#vEndDate1) "}>} OnboardCount).
Can anyone tell what the problem is?

Thanks in advance

Vidhya