Hi John,
Thanks for your reply, I tried your suggestion but I still get the same error "Cannot Perform an aggregate function on an expression containing an aggregate or a subquery. Invalid column name 'Hub_Capacity' "
any other idea? Thanks in advance.