Given that referencing row numbers can get hard in grouped reports i'd be inclined to add a secondsafter() computed field on each detail row and drag it out of view in the band. Then the duration becomes a sum(xx for group n). Seems much simpler to me.
Paul