Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating current month using prior month value

Hi All

This is my first time posting on Qlik Community as it is the first time I have encountered this issue.

Really hope someone can help me here I'm quite desperate

Example.png

As per the screenshot above I need some help with an expression to calculate the opening stock for months Feb - Dec.

January opening stock is calculated using a file upload, where as the opening stock for the following months uses the closing stock for the month prior i.e. Feb Opening Stock = Jan Closing Stock.

Closing stock = Opening Stock - Sales Actual + Production Actual

Also note that the screenshot is a pivoted view of my table in Qlikview i.e. the months are a dimension and Opening Stock, Sales Actual, etc are expressions.

If anyone has any ideas on an expression that includes the calculation for the January Opening Stock as well as the subsequent month's opening stock please reply.

Thanks everyone!

1 Reply
hector_munoz
Specialist
Specialist

Hi Suren

You could replace your current 'Opening Stock (T)' expression for something like:

If(Month = 'Jan', Sum(<field>), Before([Closing Stock (T)]))

I hope it serves...

Regards,

H