Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

sum if set analysis

hi there,

I want to write;

sum (sales)

filter1 : addmonths -2 (2 months before today)

filter2 : country=germany

can you help me write tihs with set analysis?

thanks.

6 Replies
Anil_Babu_Samineni

Perhaps this?

Sum({<DateField = {">=$(=AddMonths(Date(Today()), -2)) <=$(=Date(Today()-1))"}, country = {'germany'}>}sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

May be this

Sum({<country = {'germany'}, Date = {"$(=Date(AddMonths(Today(), -2)))"}>}sales)

Anonymous
Not applicable
Author

what is the $ for ?

Anonymous
Not applicable
Author

and my date filter is in 'YYYYMM'

so is it :

=Sum({<country = {'Germany'}, Date = {"$(=Date(AddMonths(Today(), -2),'YYYYMM'))"}>}sales)

(error)

MK9885
Master II
Master II

=Sum({<country = {'Germany'}, Num_Month = {$(=Max(Num_Month)-2)}>}sales)

This may work if you have months in numeric.

Like 1,2,3,4,....12