Added fix to allow no measures - only count(pk) will be created.