setup query for reports