Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
vijayit43
Creator
Creator

Problem In Sum

Hi Expert,

               In My data 5 field CustomerCode,OrderNo,ReleaseDate,PendingDate,Qty and one variable field vDate we want to sum those data which vDate is greater than(>) ReleaseDate and vDate is less than(<) PendingDate, how to write condition please suggest.

4 Replies
maxgro
MVP
MVP

if date fields and variable have the same format

sum({$ <ReleaseDate={"<$(vDate)"}, PendingDate>{">$(vDate)"}>}  somefield)

JonnyPoole
Former Employee
Former Employee

The exact syntax could be different but you can use an if() condtion or Set Analysis to do this:

1.  Sum(  if( ReleaseDate > $(vDate) and PendingDate < $(vDate),  Qty) )

or

2.  Sum (  {<ReleaseDate={">$(vDate)"},PendingDate={"<$(vDate)"}>}   Qty  )

If neither works as is, see if you can post an app.

petter
Partner - Champion III
Partner - Champion III

Sum( { <ReleaseDate = { "<$(Num(vDate))" } , PendingDate = { ">$(Num(vDate))" } > } Qty )

I think ... and maybe you should have <= and >= instead ?  Inclusive ....

Anonymous
Not applicable

sum({$<RealeaseDate={"<=$(vDate)"},PendientDate={">=$(vDate)"}>}Field)