Fxi bug in group by query filtering for keys

A key error was raised when grouping and filtering on the same key.