title: A complex ragged hierarchy and generic queries in MDX with compound keys
body: <p>Dimension is made with collection of key column attributes so:</p>
  
  <pre><code>...   
  hierarchylevel2key = level2attribute + level1attribute
  hierarchylevel1key = level1attribute
  ...
  </code></pre>
  
  <p>Hierarchy has many levels, so in the lowest levels of the hierarchy, the key combinations are quite complex:</p>
  
  <pre><code>[Dim].[Hierarchy].[level1].&amp;[level2]&amp;[level3]&amp;[level4]&amp;[level5]&amp;[level6]&amp;[level7]
  </code></pre>
  
  <p>Now if i want to make a generic named set for level5 members, it's in MDX:</p>
  
  <pre><code>[Dimension].[Hierarchy].[level5].members.item(2)
  </code></pre>
  
  <p>and it returns the second member of the level5, but because the <strong>hierarchy is ragged (?)</strong> sometimes this item(2) does not exist.</p>
  
  <p>.</p>
  
  <p>Do i have to make gazillion of different named sets and manually have to pick the right existing items for the sets? </p>
  
  <p>Or alternatively have i made mistake building the dimension hierarchy this way ?</p>