Fill gaps for grouped period query

@robyoung
@maxfliri