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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Last Month Units - Set Analysis

Hi all,

I'm trying to show the number of units sold for last month using set analysis. My expression I have is below which I thought would work but doesn't.

Any help would be much appreciated.

sum({<UNIT.SOLD_MONTH = {"$(=month(addmonths(today),-1))"}>} UNIT.TOTALSOLD)

Thanks

Gareth

13 Replies
MK_QSL
MVP
MVP

Use below expression

=SUM({<

  UNIT.SOLD_MONTH= {"$(=Month(AddMonths(Today(),-1)))"},

  UNIT.SOLD_YEAR= {"$(=Year(AddMonths(Today(),-1)))"}

>} UNIT.TOTALSOLD)

sunny_talwar

The above is assuming that UNIT.SOLD_MONTH is a field which is date field as well. I would check if that's true by checking if Num(UNIT.SOLD_MONTH) in a list box gives you number. If it does than Mayil and Pradeep's expression should work for you. Else fix the UNIT.SOLD_MONTH in the script

sasikanth
Master
Master

hi,

Try to take one separate field for month and use the same in the expression

Sum({< Month_field = {"$(=Month(AddMonths(Today(),-1)))"}>} UNIT.TOTALSOLD)

or 

exp is like :

Sum({<UNIT.SOLD_MONTH = {"$(=Date(AddMonths(Today(),-1),'MMM-YY'))"}>} UNIT.TOTALSOLD)

Anonymous
Not applicable
Author

Thank you so much for everyone's help and advice!

Thanks

Gareth