Skip to main content
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
swuehl
MVP
MVP

How do your closeDate field values look like? What is the format of your field?

And how do your variables look like when dollar sign expanded (you can check this e.g. by using text boxes)?

Not applicable
Author

below is the screen shot of variables

dates defined.png

and if i use them directly in text box like below

=$(vstartdate)

=$(venddate)

it shows the correct date

Not applicable
Author

Try this

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

Not applicable
Author

or this

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

swuehl
MVP
MVP

Your QV functions need to be interpreted before passing to the search string, try

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

Not applicable
Author

i tried it but showing me zero in return

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

Not applicable
Author

its returning 0 as output

Not applicable
Author

What is the date format in closeDate Field? Does the date format in closeDate field matches the Date format of your variables?

swuehl
MVP
MVP

Ok,

try using the orginal version:

Your QV functions need to be interpreted before passing to the search string, try

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


But define your variables with a preceding equal sign:

=today()

=makedate(2012,1,1)