# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for
Did you mean:
Contributor III

## Total Aging Not Correct...

Dear All.

I trying to create Aging Stock Report ( After 1 - 2 - 3 -....-12 Month )

the Aging after 1 month = the purchase month before

the Aging after 2 month = the purchase 2 month before

the Aging after 3 month = the purchase 3 month before

....

...

..

( we continue calculate one month before until we arrive the current stock Quantity then 0 )

I make the formula and everything is okay..

#### BUT ...!?? the Total for each Aging Not CORRECT..??!!!!!!

I want to know the correct total aging Or the total aging for multi Items.

found attachment example

1 Solution

Accepted Solutions
Master

Hi, You need to use aggr to get this to work. Do like this in all expressions

sum(aggr(if(
(
if(sum(Purchase)>sum([Current Stock])
,
sum([Current Stock])-sum({\$<Month={'Dec','Nov','Oct','Sep','Aug','Jul','Jun','May','Apr','Mar','Feb'}>}Purchase)
,
sum({\$<Month={'Jan'}>}Purchase)))<0
,0,
if(sum(Purchase)>sum([Current Stock])
,
sum([Current Stock])-sum({\$<Month={'Dec','Nov','Oct','Sep','Aug','Jul','Jun','May','Apr','Mar','Feb'}>}Purchase)
,
sum({\$<Month={'Jan'}>}Purchase) )),[Item Code]))

Master

Hi, You need to use aggr to get this to work. Do like this in all expressions

sum(aggr(if(
(
if(sum(Purchase)>sum([Current Stock])
,
sum([Current Stock])-sum({\$<Month={'Dec','Nov','Oct','Sep','Aug','Jul','Jun','May','Apr','Mar','Feb'}>}Purchase)
,
sum({\$<Month={'Jan'}>}Purchase)))<0
,0,
if(sum(Purchase)>sum([Current Stock])
,
sum([Current Stock])-sum({\$<Month={'Dec','Nov','Oct','Sep','Aug','Jul','Jun','May','Apr','Mar','Feb'}>}Purchase)
,
sum({\$<Month={'Jan'}>}Purchase) )),[Item Code]))

Community Browser