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

Set Analysis with expression

Not sure why I can't get this to work...

=Sum({$<Det.PostingDate_Month|Year={$(=addmonths(max(Det.PostingDate_Month|Year),-1))}>Det.NetAmt)

I want to sum the Det.NetAmt for 1 month prior to my month|year field

Any Ideas? I'm getting an error in set modifier ad hoc eliment list.

Much thanks,

-David

1 Reply
JonnyPoole
Former Employee
Former Employee

=Sum({$<Det.PostingDate_Month|Year={$(=addmonths(max(Det.PostingDate_Month|Year),-1))}> }  Det.NetAmt)


I noticed a missing closing '}'


Also i suggest enclosing that field name in square brackets  :  []


=Sum({$<[Det.PostingDate_Month|Year]={$(=addmonths(max([Det.PostingDate_Month|Year]),-1))}> }  [Det.NetAmt])



If that doesn't help, maybe try calculating the addmonths() expression in a variable, confirming the variable value and using the variable in the SET MODIFIER. Something like this:


=Sum({$<[Det.PostingDate_Month|Year]={$(vPriorMonth) }> }  [Det.NetAmt])