Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
mrainey18
Contributor

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
Contributor

Re: Variable and Set Analysis

Got it:

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

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

5 Replies
Employee
Employee

Re: Variable and Set Analysis

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

mrainey18
Contributor

Re: Variable and Set Analysis

They are the same. 

Employee
Employee

Re: Variable and Set Analysis

Could you double check?

mrainey18
Contributor

Re: Variable and Set Analysis

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
Contributor

Re: Variable and Set Analysis

Got it:

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

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

Community Browser