score:6

Accepted answer

you can try this with a pair of groupby and a pair of calls of todictionary, like this:

var res = list
    .groupby(v => v.id)
    .todictionary(
        g => g.key
    ,   g => g.groupby(v => v.start_date.date)
        .todictionary(h => h.key, h => h.seelct(x => x.id_owner).distinct().count())
    );

if you would like to also add the total time per day, you can do this:

var res = list
    .groupby(v => v.id)
    .todictionary(
        g => g.key
    ,   g => g.groupby(v => v.start_date.date)
        .todictionary(h => h.key, h => new {
             count = h.seelct(x => x.id_owner).distinct().count())
         ,   totaltime = h.sum(h => x.end_date-x.start_date)
         }
    );

Related Query

More Query from same tag