Creating a subset of elements based on the values in a cube