Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
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 (3)
3 Replies
agigliotti
MVP
MVP

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.

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
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
MVP
MVP

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.

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it