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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current Month /Previous Month Calculation

Dear All,

I am using set Analysis for Currentmonth stock and previous month stock

for current month i am using the expression as below

CurrentMonthStock:

(



Sum({$<Month={$(=Only(Month))}>} LGStockTable.CLOSINGSTOCK))

Previous Month

(

Sum({$<(Month)={$(=Only((Month))-1)}>} LGStockTable.CLOSINGSTOCK))

I get correct value for Currentmonth stock

But for previous month i get null i.e -

where am i going wrong in previous month calculation.

I tried to use num function also to convert month in numeric form

and the modified expression i wrote for previous month calculation is:

(Sum({$<num(Month)={$(=Only((numMonth))-1)}>} LGStockTable.CLOSINGSTOCK))







But still got null value for previous month

Can anyone help me immediately on this

Regards

Arvind

2 Replies
Not applicable
Author

Hi,

Use the below expression to get the Previous month sales.

=sum({<Month={"$(=date(addmonths(max(Months1),-1),'MMM'))"}>} Sales)

Not applicable
Author

Hi ,

even i am also facing the same issue 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

For Current Month :

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

For Previous Month:

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

Please help me on this as this is urgent.