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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
jgarnav
Contributor
Contributor

Calculate data from previous 7 days

Hello 

I have this script and i would like to add a new column for "produccion" with the date from Fecha informe to be 7 days back.

Something like this:

Fecha Informe Fecha Query Produccion Produccion-7
01/01/2022 01/01/2022 100  
02/01/2022 01/01/2022 150  
03/01/2022 01/01/2022 160  
04/01/2022 01/01/2022 170  
05/01/2022 01/01/2022 180  
06/01/2022 01/01/2022 160  
07/01/2022 01/01/2022 130 100
08/01/2022 01/01/2022 100 150
09/01/2022 01/01/2022 115 160
10/01/2022 01/01/2022 120 170

 

Thanks

 

LOAD
FechaInforme,
Hotel,
"Fecha Query",
ID_HABITA,
OriMer,
Region,
"Habitaciones Hotel",
"Habitaciones Bloq.",
"Habitaciones Disp.",
Habitaciones,
"Pax Query",
"Adultos Query",
"Niños Query",
Produccion
FROM [....../InformeDiario/pickup_ocupacion_canal.csv]
(txt, utf8, embedded labels, delimiter is ';', msq);

LOAD
ID_HABITA,
Habitacion,
Descripcion
FROM [...../Maestros/habitaciones.csv]
(txt, utf8, embedded labels, delimiter is ';', msq);

 

 

 

 

 

Labels (4)
1 Reply
chaorenzhu
Creator II
Creator II

You can use peek(Produccion,-6) as "Produccion-7" 

remember to order by FechaInforme