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: 
simbai94
Contributor II
Contributor II

CURRENT MONTH vs PRIOR MONTH

Hello All,

I am trying to create a bar graph that compares current month to prior month. I have used the expression below for Current Month and it seems to be showing the correct results:

Count( { $< [ASOF.autoCalendar.MonthRelNo]={0}, [ASOF.autoCalendar.YearsAgo]={0} > } [Customers] )

I then tried to use the  below expression  for Previous Month but it is showing 0.

Count( { $< [ASOF.autoCalendar.MonthRelNo]={1}, [ASOF.autoCalendar.YearsAgo]={1} > } [Customers] )

Any idea how I can make this work?

PS:I am using the enterprise version of Qlik Sense

Thank you!

3 Replies
Ksrinivasan
Specialist
Specialist

hi,

previous month means -1 not 1,

ksrinivasan

simbai94
Contributor II
Contributor II
Author

Hi Ksrinivasan,

Many thanks for your response. I tried changing the 1 to -1 and I am getting an error in expression message. Perhaps you could assist me on alternative way to do the comparison that does not involve creating variables or using a load script. These methods are kind of difficult to implement on the enterprise version of Qlik. Thank you. 

 

SM

Ksrinivasan
Specialist
Specialist

hi,

try this

Sum({<Year= ,Month=, [Calendar Year/Month] = {">=$(=AddMonths(Max([Calendar Year/Month])), -1)<=$(=Max([Calendar Year/Month])) "}>} Amount)

ksrinivasan