Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
xxcarlosxx
Contributor III
Contributor III

Registro anterior - Previous record

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:

xxcarlosxx_0-1655238182616.png

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
] ;

Labels (3)
1 Solution

Accepted Solutions
MayilVahanan

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:

MayilVahanan_0-1655267968577.png

 

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

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:

MayilVahanan_0-1655267968577.png

 

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
xxcarlosxx
Contributor III
Contributor III
Author

Thank you very much @MayilVahanan it was what I needed. 👍