Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
MVP
MVP

Re: Calculate sum based onCurrent selection date.

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
Highlighted
MVP
MVP

Re: Calculate sum based onCurrent selection date.

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.

Highlighted
Not applicable

Re: Calculate sum based onCurrent selection date.

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

Highlighted
MVP
MVP

Re: Calculate sum based onCurrent selection date.

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

Highlighted
Not applicable

Re: Calculate sum based onCurrent selection date.

Hi,

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

Thank you

Prajna

Highlighted
Not applicable

Re: Calculate sum based onCurrent selection date.

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

Highlighted
Not applicable

Re: Calculate sum based onCurrent selection date.

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?

Highlighted
Not applicable

Re: Calculate sum based onCurrent selection date.

Hi

only function refer ,current selection value 

let us suppose

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

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