CEIL(NVL(MIN(CASE WHEN {inventorylocation.id}=’5′ OR {memberitem.inventorylocation.id}=’5′ THEN (CASE WHEN {type}=’Inventory Item’ THEN (NVL({locationquantityonorder},0)) ELSE (NVL({memberitem.locationquantityonorder},0)/{memberquantity}) END) END),0))