mbGroupCJS function

Calculate CJS for each group for each array