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: 
Not applicable

Calculate sum based onCurrent selection date.


Hi,

I wanted to get sum of  amount that is transacted in less than or equal to current selection date in a bar chart. My selection is based  on Month name. Can anyone help me out

Regards,

Prajna

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Then try:

Sum({<Month={"<=$(Max(Month))"}>}Amount)      // If month is created in the script using month() function, it should work.

View solution in original post

7 Replies
tresesco
MVP
MVP

Try something like:

Sum({<Date={"<=$(Max(Date))"}>}Amount)  // assuming Date field is there. Otherwise there would be couple of things to be careful of, like if you want single year data or all the months from last years as well; date format. Best would be if you could share sample app.

Not applicable
Author

selection field has only month name and year. year (2011,2012,2013) and month name from Jan to dec.

Ex:  If I select year= 2011 and month name = 'Apr''

Then I want sum of amt  from Jan to Apr for year 2011

tresesco
MVP
MVP

Then try:

Sum({<Month={"<=$(Max(Month))"}>}Amount)      // If month is created in the script using month() function, it should work.

Not applicable
Author

Hi,

I tried with a key that I had created for month table it worked

Thank you

Prajna

Not applicable
Author

Hi

use this expression ,its working fine.

sum({<datefield={"<=$(=only(datefield))"}>}amount)

or

if u need to use upto current date,if u have year ,quarter ,month fields then use below condition

sum({<datefield={"<=$(=only(datefield))"},year=,quarter=,month= >}amount)

this expression gives up to current month

Not applicable
Author

hi,

year, quarter and month are these referring to same date field?

I mean I have year and month_name taken from two different fields..so this is not working for me I am getting common value for all selection

can u just telling the use of only?

Not applicable
Author

Hi

only function refer ,current selection value 

let us suppose

year=2000,2001,2002,.....

if u select 2000 ,then only(year)=2000