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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the previous month data at the expression level

Hi ,

I am  facing the  issue in getting the data for the previous month and i have written the expression as to get the previous month closing inventory qty as current month opening inventory qty but the thing is i am not getting this instead i am getting 0 value

The expression which i have used is as shown below:

For Current Month :

sum({<CalendarMonthID={$(VCurrentCalendarFiscalMonth)}>}inventoryqty)

For Previous Month:

sum({<CalendarMonthID={$(Vcurrentcalendarfiscalmonth-1)}>}inventoryqty)

But still i am not able to get the exact value

Please help me on this as this is urgent.

Regards,

Smita

3 Replies
Not applicable
Author

Hi,

Use this in getting the previous month.

Date(AddMonths(Date#(Today(),'YYYY-MM-DD'),-1), 'YYYY-MM-DD')

Regards,

Janzen

SunilChauhan
Champion II
Champion II

please find Month-Year(Jan-2012) in your application.

if not then calculate from Month

then in expression use below codes

Current Month

sum({<MonthYearField={$(=Date(Max(MonthYearfield),'MMM-YYY'))}>} amountfield)

previous MONTH

sum({<MonthYearField={$(=Date(addmonths(Max(MonthYearfield),-1),'MMM-YYY'))}>} amountfield)

hope this helps

Sunil Chauhan
Not applicable
Author

thanks for the help ,i will try this and will let you know