there are probably some more elegant solutions, but you can start with something like this:
(ooxml, embedded labels);
//Flag the records to ignore
LOAD Id, Statut,[begin Date],[End date],duration,
if(peek(StopFlag) and peek(Id) = Id, 1,StopFlag) as StopFlag;
LOAD *, if(Statut='Closed' or Statut='Accepted',1) as StopFlag
Resident INPUT where not Statut like 'Question*' order by Id, [begin Date] asc;
//Calculate the sum of durations grouped by Id
LOAD Id, interval(sum(duration)) as SumDuration,count(duration) as CountDuration
resident TMP where isnull(StopFlag) group by Id;
drop Table TMP;
One more question about this isue...
I would like also the date of stopflag.
for example for the ID 145554 this date is the begin date of the blue line (Accepted : 8/1/12)
I tried with :
interval(max([begin_date])) as [Date StopFlag]
but t've got only the date of the last one before the blue line which is not 'question to customer'.