Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need a help

how to calculate both Opening stock and Closing Stock from one field?

Closing Stock = sum(Closing_stock) of Jul 2013 i.e 10000

Opening Stock = 10000  of Aug 2013

i.e the value I get as Closing Stock of Jul 2013 is same as Opening Stock of Aug 2013

eg,

                                   July 2013    Aug 2013     Sep 2013   Oct2013

Opening Stock                  0             10000              5000     0

Closing Stock                  10000         5000               0         2000

I am calculating Closing Stock as Sum(closing_stock)  . the table has only one value closing_stock , depending on closing_stock I have to calculate Opening Stock.

1 Reply
abeyphilip
Creator II
Creator II

Hi Kal,

Have one dimension (eg: Measure) to have value Opening Stock & Closing Stock.

Then create one expression for each month,

eg: expression for Aug 2013

if(Measure='Opening Stock', sum({<Month={'Jul 2013'}>} Amount),

sum({<Month={'Aug 2013'}>} Amount))

For Sep 2013

if(Measure='Opening Stock', sum({<Month={'Aug 2013'}>} Amount),

sum({<Month={'Sep 2013'}>} Amount))

rgds,

Abey