title: MDX - TopCount plus 'Other' or 'The Rest'
body: <p>I have created an MDX query which calculates the TOP 10 ZipCodes (according to my Patient Stay measure) as such: </p>
  
  <pre><code>WITH
  MEMBER [Discharge Date].[Y-M-D].[ Aggregation] AS 'AGGREGATE( EXISTING { [Current Month] } )', SOLVE_ORDER = 0
  
  SELECT
  NON EMPTY { [Measures].[Patient Stays] }
  ON COLUMNS,
  
  TOPCOUNT({ ORDER( HIERARCHIZE( { [Patient].[ByZipcode].[All].CHILDREN } ), ( [Measures].[Patient Stays] ), BDESC ) }, 10)
  ON ROWS
  
  FROM [Patient Stay]
  
  WHERE ( [Discharge Date].[Y-M-D].[ Aggregation], [Facility].[ByAffiliation].CURRENTMEMBER, [Facility].[ByRegion].CURRENTMEMBER )
  </code></pre>
  
  <p>This query is used to populate a PerformancePoint 100% Stacked Bar chart.  The client has asked that since this is a !00% based chart, we lump the rest of the zip codes into an "Other" field, such that there should be 11 values: one for each of the top 10, and an eleventh which is a sum of the remaining Zip Codes.</p>
  
  <p>I am an extreme novice to MDX, but this doesn't souund like it should be impossible.  Does anyone have any ideas or suggestions?</p>