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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

substract last and penultimate value

hi,

I have a table with the fields CodCliente, CodProd and Fecha.

I want to subtract the last value to the penultimate Fecha group by CodCliente and CodProd and next make the average of the substract.

This is the table:

CodClienteCodProdFecha
1130/04/2012
1107/05/2012
1115/05/2012
1226/05/2012
1218/06/2012
2102/07/2012
2125/08/2012
2109/10/2012
2215/10/2012
2223/10/2012
2202/11/2012
2214/11/2012

I need substract for the CodCliente 1 and CodProd 1 15/05/2012 - 07/05/2012 and next  substract for the CodCliente 1 and CodProd 2 18/06/2012 - 26/05/2012 and calculate de average of this.

Regards

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached example.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thanks,Gysbert, the example is exactly that i needed.

Regards