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: 
ilanbaruch
Specialist
Specialist

Set Analysis \ addmonths

hi all

trying to calculate previous three months from user selection i.e

if the user selected 201804 the expression should retrieve calculation for : 201804,201803,201802

tried it with :

SUM({<YYYYMM={"$(='>=' & date(AddMonths(max(FULL_DATE),-3),'YYYYMM'))"},MM=,YYYY=>}AMOUNT)

but it retrieves 0 , (not the actual result)


any ideas?


advanced thanks


1 Solution

Accepted Solutions
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi ilan,

Please try below highlighted :

SUM({<YYYYMM={"$(='<=' & date(AddMonths(max(FULL_DATE)),'YYYYMM'))"},MM=,YYYY=>}AMOUNT)


YYYYMM={"<=$(=AddMonths(Max(YYYYMM)))>=$(=AddMonths(Max(YYYYMM),-3))"}




Thanks,

Arvind Patil

View solution in original post

3 Replies
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi ilan,

Please try below highlighted :

SUM({<YYYYMM={"$(='<=' & date(AddMonths(max(FULL_DATE)),'YYYYMM'))"},MM=,YYYY=>}AMOUNT)


YYYYMM={"<=$(=AddMonths(Max(YYYYMM)))>=$(=AddMonths(Max(YYYYMM),-3))"}




Thanks,

Arvind Patil

ilanbaruch
Specialist
Specialist
Author

thank you very much,

below my final expression :

YYYYMM={"<=$(=AddMonths(Max(YYYYMM),0))>=$(=AddMonths(Max(YYYYMM),-3))"}


arvind_patil
Partner - Specialist III
Partner - Specialist III

Welcome

Thanks,

Arvind Patil