Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Bonjour, j'aimerais faire une différences d'heures et les classer en fonctions des jours présents dans ma table. La différence devrant se faire exclusivement entre des erreurs inférieures à 600 et celles égales à 607.
J'ai modifié l'ancien code avec ça :
Datatmp:
LOAD ID,
erreur,
Timestamp(dates) as dates,
floor(Date(dates)) as NewDate
FROM
.\donnees_test.xlsx
(ooxml, embedded labels, table is Feuil1);
load distinct NewDate as FNewDate resident Datatmp;
Data:
noconcatenate
load * resident Datatmp where (erreur <600 or erreur = 607 ) order by ID,dates ;
drop table Datatmp;
tmp2:
noconcatenate
load *,
if(rowno()=1,0,if(erreur=607,peek(value3),if(previous(erreur)<607,peek(value3),peek(value3)+1))) as value3,
if(erreur=607 and previous(erreur)=607,1,0) as Flog2
resident Data;
drop table Data;
tmp3:
load ID,value3,floor(Date(Min(dates))) as NewDate,Timestamp(Max(dates)) as Maxdates,Timestamp(Min(dates)) as Mindates,Time(Timestamp(Max(dates))-Timestamp(Min(dates))) as Interval resident tmp2 where Flog2=0 group by ID,value3;
drop table tmp2;
Final:
load ID ,Date(NewDate) as dates,Time(sum(Interval)) as Cumul resident tmp3 group by ID,NewDate;
drop table tmp3;
est ce que tu peux partager aussi un exemple des data et le output ?
Ah oui
J'ai modifié l'ancien code avec ça :
Datatmp:
LOAD ID,
erreur,
Timestamp(dates) as dates,
floor(Date(dates)) as NewDate
FROM
.\donnees_test.xlsx
(ooxml, embedded labels, table is Feuil1);
load distinct NewDate as FNewDate resident Datatmp;
Data:
noconcatenate
load * resident Datatmp where (erreur <600 or erreur = 607 ) order by ID,dates ;
drop table Datatmp;
tmp2:
noconcatenate
load *,
if(rowno()=1,0,if(erreur=607,peek(value3),if(previous(erreur)<607,peek(value3),peek(value3)+1))) as value3,
if(erreur=607 and previous(erreur)=607,1,0) as Flog2
resident Data;
drop table Data;
tmp3:
load ID,value3,floor(Date(Min(dates))) as NewDate,Timestamp(Max(dates)) as Maxdates,Timestamp(Min(dates)) as Mindates,Time(Timestamp(Max(dates))-Timestamp(Min(dates))) as Interval resident tmp2 where Flog2=0 group by ID,value3;
drop table tmp2;
Final:
load ID ,Date(NewDate) as dates,Time(sum(Interval)) as Cumul resident tmp3 group by ID,NewDate;
drop table tmp3;