Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rohi__
Contributor III
Contributor III

Sum QTY if previous operation finished

Hello Guys,

I'm trying to create a KPI that shows me the current status of orders to be completed.
For example, I want to evaluate the work center Q.
But now the step Prod must be completed first.
I have developed this formula so far, unfortunately, it does not work as soon as I have more than one entry.

aggr(if(len(Status)=0,sum(distinct {<Workplace= {'Q'}>} QTY)), Order, Workplace, Operation)

Can anyone help me?

Thanks in advance!

 

Sample Data:

OrderOperationQTYStatusWorkcenter
11070DoneProd
12070-Q
21071DoneProd
22071-Q

The solution would be 141 (70+71)

OrderOperationQTYStatusWorkcenter
11070-Prod
12070-Q
21071DoneProd
22071-Q

The solution would be 71

Labels (4)
3 Replies
agigliotti
Partner - Champion
Partner - Champion

maybe this:

=Sum( aggr( if( count( {< Workplace = {'Prod'}, Status = {'Done'] >} Operation ) > 0, sum( {< Workplace = {'Q'} >} if( len(Status) = 0, QTY ) ) ), Order ) )

I hope it can helps.

rohi__
Contributor III
Contributor III
Author

Hi @agigliotti ,

thanks so much for your fast reply!

It worked as expected!

The next task would be to make this formula dynamic. 

For example, I wanna calculate the KPI for a random work center, the one which I would choose with a filter.

How do I have to change that formula, that it would always check if the previous operation is finished and if yes it would calculate?

Thanks in advance!

agigliotti
Partner - Champion
Partner - Champion

I'm not sure if I well understood what you asked.

anyway let's try removing {< Workplace = {'Q'} >}

in order to get the value from the filter.