Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an table with the position of the accounts (POS) to a certain date
Cuenta - Fecha - Posición
and another with the movements each day (MOV)
Cuenta - Fecha - Importe
I want to get a table with the following data:
Cuenta - Fecha - Entradas - Salidas - Posición
with one record for each date.
Where "Entradas" = sum(Importe if >0) and "Salidas" = sum(Importe if <0)
Thank's for your help
Is this what you are after?
Temp:
LOAD Cuenta,
Fecha,
Posición
FROM ... ;
Join(Temp)
LOAD Cuenta,
Fecha,
Importe
FROM ... ;
Final:
LOAD Cuenta,
Fecha,
Posición,
Sum(RangeMax(Importe, 0)) as Entradas,
Sum(RangeMin(Importe, 0)) as Salidas
Resident Temp
Group By Cuenta,
Fecha,
Posición;
DROP TABLE Temp;
Thank's for your response, but is not that.
I explain more.with an example.
Table POS
Cuenta | Fecha | Posición |
0128 9464 40 0100014362 | 11/10/2016 | 2.905,24 |
Table MOV
Cuenta | Fecha | Importe |
0128 9464 40 0100014362 | 06/10/2016 | - 140,67 € |
0128 9464 40 0100014362 | 06/10/2016 | - 128,37 € |
0128 9464 40 0100014362 | 03/10/2016 | - 9,05 € |
0128 9464 40 0100014362 | 03/10/2016 | - 111,77 € |
0128 9464 40 0100014362 | 03/10/2016 | - 48,31 € |
0128 9464 40 0100014362 | 03/10/2016 | - 24,47 € |
0128 9464 40 0100014362 | 30/09/2016 | - 723,38 € |
0128 9464 40 0100014362 | 30/09/2016 | - 18,15 € |
0128 9464 40 0100014362 | 28/09/2016 | - 40,39 € |
0128 9464 40 0100014362 | 28/09/2016 | - 364,39 € |
0128 9464 40 0100014362 | 28/09/2016 | - 54,65 € |
0128 9464 40 0100014362 | 28/09/2016 | - 737,42 € |
0128 9464 40 0100014362 | 28/09/2016 | - 53,95 € |
0128 9464 40 0100014362 | 26/09/2016 | - 162,21 € |
0128 9464 40 0100014362 | 26/09/2016 | - 1.549,72 € |
0128 9464 40 0100014362 | 21/09/2016 | - 284,12 € |
The expected result I upload an excel example