Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
swatiras
Contributor
Contributor

Set analysis based on date selection

Hi , I am trying to sum up monthly figures, based on list-box selection.

This is the expression i used : 

=Sum({$<DT_MONTHYEAR ={">=$(=Date(max([DT_MONTHYEAR])))"}>}AMOUNT)

This one works fine , but unable to write and expression to give AMOUNT sum for previous MonthYear(previous to the one currently selected)

 

 

Labels (1)
1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Like this:

=Sum({$<DT_MONTHYEAR ={">=$(=AddMonths(Max([DT_MONTHYEAR]), -1))"}>} AMOUNT)

You may need to override selections if you are making date selections in another field. Example:

=Sum({$<DT_MONTHYEAR ={">=$(=AddMonths(Max([DT_MONTHYEAR]), -1))"}, Year, Month>} AMOUNT)
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
jyothish8807
Master II
Master II

Hi Try this:

Assuming you have a Year field in your data model.

=Sum({$<DT_MONTHYEAR ={">=$(=Date(max([DT_MONTHYEAR])))"},Year ={"=$(=Year(max([DT_MONTHYEAR]))-1)"}>}AMOUNT)

Best Regards,
KC
jonathandienst
Partner - Champion III
Partner - Champion III

Like this:

=Sum({$<DT_MONTHYEAR ={">=$(=AddMonths(Max([DT_MONTHYEAR]), -1))"}>} AMOUNT)

You may need to override selections if you are making date selections in another field. Example:

=Sum({$<DT_MONTHYEAR ={">=$(=AddMonths(Max([DT_MONTHYEAR]), -1))"}, Year, Month>} AMOUNT)
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
swatiras
Contributor
Contributor
Author

Another issue : 

Lets say i want to find out the average based upon the number of days in the month. 

I need a set analysis expression like : 

=Sum({$<MONTHYEAR ={">=$(=Date(max([MONTHYEAR])))"}>}AMOUNT)/divide by the number of days in the MONTHYEAR selected in the 'MONTHYEAR' listbox