Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello friends.
Again, please help me with this problem that I cannot solve,
what I want is to obtain the previous record according to the zone, I have tried with PEEK,
but it is not bringing me the data that I need. Please could you help me.
Hola amigos.
Nuevamente solicito de favor puedan ayudarme, con este problema que no logro resolver, lo que quiero es obtener el registro anterior según la zona, he intentado con PEEK, pero no me esta trayendo el dato que necesito. Por favor podrían ayudarme.
Estuve intentado con este script:
AutoNumber(RowNo(), Zona) AS zona,
Peek(TotalEfectivo,-1) as camponuevo
Gracias!
Resultado Final:
PRINCIPAL:
LOAD * INLINE [
Periodo, Zona, TotalEfectivo
20220430, 1, 24063200663
20220331, 1, 23852979175
20220228, 1, 22242836206
20220131, 1, 22365402529
20211231, 1, 22772151114
20211130, 1, 22855835045
20211031, 1, 22730847757
20210930, 1, 22956180379
20210831, 1, 22882623990
20210731, 1, 22829910488
20220430, 2, 22355510934
20220331, 2, 23507688573
20220228, 2, 21282430115
20220131, 2, 21269675656
20211231, 2, 21210287377
20211130, 2, 21547508148
20211031, 2, 21556917484
] ;
HI
Try like below
PRINCIPAL:
LOAD * INLINE [
Periodo, Zona, TotalEfectivo
20220430, 1, 24063200663
20220331, 1, 23852979175
20220228, 1, 22242836206
20220131, 1, 22365402529
20211231, 1, 22772151114
20211130, 1, 22855835045
20211031, 1, 22730847757
20210930, 1, 22956180379
20210831, 1, 22882623990
20210731, 1, 22829910488
20220430, 2, 22355510934
20220331, 2, 23507688573
20220228, 2, 21282430115
20220131, 2, 21269675656
20211231, 2, 21210287377
20211130, 2, 21547508148
20211031, 2, 21556917484
] ;
PRINCIPALfinal:
LOAD *, If(Zona = Peek(Zona), Peek(TotalEfectivo)) as CampoNuevo Resident PRINCIPAL Order by Zona, Periodo;
DROP Table PRINCIPAL;
O/P:
HI
Try like below
PRINCIPAL:
LOAD * INLINE [
Periodo, Zona, TotalEfectivo
20220430, 1, 24063200663
20220331, 1, 23852979175
20220228, 1, 22242836206
20220131, 1, 22365402529
20211231, 1, 22772151114
20211130, 1, 22855835045
20211031, 1, 22730847757
20210930, 1, 22956180379
20210831, 1, 22882623990
20210731, 1, 22829910488
20220430, 2, 22355510934
20220331, 2, 23507688573
20220228, 2, 21282430115
20220131, 2, 21269675656
20211231, 2, 21210287377
20211130, 2, 21547508148
20211031, 2, 21556917484
] ;
PRINCIPALfinal:
LOAD *, If(Zona = Peek(Zona), Peek(TotalEfectivo)) as CampoNuevo Resident PRINCIPAL Order by Zona, Periodo;
DROP Table PRINCIPAL;
O/P:
Thank you very much @MayilVahanan it was what I needed. 👍