Qlik Community

Ask a Question

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 
Search instead for 
Did you mean: 
ghassanaldalati
Contributor III
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.


please help me.


found attachment example

1 Solution

Accepted Solutions
stabben23
Master
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]))

View solution in original post

1 Reply
stabben23
Master
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]))

View solution in original post