Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
scotly-victor
Creator II
Creator II

Previous month vs Current Month in Qlik sense

Hi Qlikers,

I wanted to show line Chart  for Previous month and current month for dimension :Month-> Day


Expression for current month 

=sum({<type={'Order'},FiscalYear={$(=max(FiscalYear))}>} Sales)

Current Month works fine

Expression for Previous month

=sum({<type={'Order'},FiscalYear={$(=max(FiscalYear))},MonthID={$(=max(MonthID)-1)}>} Sales)

It Showing Wrong output

Can anyone help me?


11 Replies
MK_QSL
MVP
MVP

If you have Month as Dimension, then you have to keep in mind that in QlikView Set Analysis, Set Expression will evaluate once only per chart..

Kushal_Chawda

Don't you think, Current month should like this?

sum({<type={'Order'},FiscalYear={"$(=max(FiscalYear))"},MonthID={"$(=max(MonthID))"}>} Sales)

Kushal_Chawda

for previous try this

=above(sum({<type={'Order'},FiscalYear={"$(=max(FiscalYear))"}>} Sales),0,rowno())

scotly-victor
Creator II
Creator II
Author

Thank you Kushal Chawda

Sorry it didn't work

sunny_talwar

Would you be able to share a sample?

scotly-victor
Creator II
Creator II
Author

It may be look like it

pm vs cm.png

Silambarasan1306
Creator III
Creator III

Better u can use "above" function to get the data's of previous month.

jayaseelan
Creator III
Creator III

Hi,


Use above function : (above(sum({<type={'Order'},FiscalYear={"$(=max(FiscalYear))"}>} Sales))


and set previous year max month in the variable then use that variable in null values in the column.

reddy-s
Master II
Master II

Hi Scotly,

In our master calendar, make use of inMonth() and InMonthToDate() function to set flags and make use of these flags in set analysis.

This will even improve the performance.

Thanks,

Sangram.