Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum from January to selected month

Hi,

I have data as shown below:       

YearMonthSales
2000January10
2000February10
2000March10
2000April10
2000May10
2000June10
2000July10
2000August10
2000September10
2000October10
2000November10
2000December10
2001January20
2001February20
2001March20
2001April20
2001May20
2001June20
2001July20
2001August20
2001September20
2001October20
2001November20
2001December20

I need to do Sum of Sales between January of Selected year till Selected Month of that Year  .for eg In above scenario if I select Year =2000(listbox) and Month=March(listbox) then expression should show sum= 30.

5 Replies
MayilVahanan

Hi

     Do you have date field?

     If so, use like this,

     =Sum({<DateField = {'>=$(=MonthStart(Min({1}DateField))) <= $(=MonthEnd(DateField))'}>}Sales)

     Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi Mayil,

Thanks for response. Its giving me the result as 0.

As we are using Year and Month as List box in Dashboard ,the Date Field is present in the script but not in Dashboard So user can only select Year and Month not Date Field.

Not applicable
Author

Hi Mayil,

Thanks for response. Its giving me the result as 0.

As we are using Year and Month as List box in Dashboard ,the Date Field is present in the script but not in Dashboard So user can only select Year and Month not Date Field.

MayilVahanan

Hi

     Can you post a sample file?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

Try using function InYearToDate().  Probably like this, or close to it (assuming Month has numeric value, and Date is sales date):

sum({1} if(InYearToDate(Date, monthend(makedate(Year,Month)), 0), Sales))

Regards,

Michael