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: 
gauravgg
Partner - Creator
Partner - Creator

Sum the amount from a range of date

hi

i have a following variables

vmincamp =date(min(Cdate),'DD/MM/YYYY')

vmincamp2=date(interval(min(Cdate) + 2,'D'),'DD/MM/YYYY')

According to my application these variables contain the following values

vmincamp= 01/01/2016

vmincamp2=03/01/2016

I want to write an expression which will sum the Orderamount  range from vmincamp to vmincamp2

ie sum of Orderamount from 01/01/2016 to 03/01/2016

How to write the expression ?

8 Replies
Chanty4u
MVP
MVP

=sum({ <$(vmincamp)+$(vmincamp2)>}Orderamount  )

Anonymous
Not applicable

sum({<Cdate={'>=$(=vmincamp)<=$(=vmincamp2)'} >}Orderamount)



gauravgg
Partner - Creator
Partner - Creator
Author

hi rgv

it is showing following error in Textboject

Error:Error in set modifier ad hoc element list: ',' ro ')' expected

maxgro
MVP
MVP

if the Cdate field and the variables have the same format

sum({<Cdate={">=$(vmincamp)<=$(vmincamp2)"}>} Orderamount

Chanty4u
MVP
MVP

replace single quotes to double

gauravgg
Partner - Creator
Partner - Creator
Author

hi , maxgro

no it showing the sum as 0 which is wrong

can u help me

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

=sum({<Cdate={'>=$(=vmincamp)<=$(=vmincamp2)'}>} Orderamount)

Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

Note Cdate and variables date format should be in the same format.  Otherwise the expression won't work.

Regards,

Jagan.