Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
mrainey18
Creator
Creator

Variable and Set Analysis

I am trying to do a sum of months less than the current month/year:

Sum({<[CalendarDate.autoCalendar.YearMonth] =- { '$( =$(vCurrMonthYear) )' }>}Total)

vCurrMonthYear = MonthName(addmonths(today(),-1))

This does not work.  Any other ideas?

1 Solution

Accepted Solutions
mrainey18
Creator
Creator
Author

Got it:

Sum({$<CalendarDate = { "$(='<' & $(vCurrMonthYear))" }>}Total)

vCurrMonthYear = num(MonthName(addmonths(today(),0)))

View solution in original post

5 Replies
Clever_Anjos
Employee
Employee

Which format are your variable output and your calendar field? Are they the same?

mrainey18
Creator
Creator
Author

They are the same. 

Clever_Anjos
Employee
Employee

Could you double check?

mrainey18
Creator
Creator
Author

Yes.  I did check.  They match both are formatted "MMM YYYY"

Should I use a different format?  I tried num() but couldnt get the less than to work.  Do you know how to do that?

Something like this:

vCurrMonthYear = num(MonthName(addmonths(today(),-1)))

Not sure where to put the <..

Sum({<CalendarDate =- { '$( =$(vCurrMonthYear) )' }>}Total)

CalendarDate is already the min number of each month.

mrainey18
Creator
Creator
Author

Got it:

Sum({$<CalendarDate = { "$(='<' & $(vCurrMonthYear))" }>}Total)

vCurrMonthYear = num(MonthName(addmonths(today(),0)))