title: MDX Ordering By Dimension
body: <p>Over in the SQL side, my data is looking like this: </p>
  
  <pre><code>Select f.id, f.TimeKey,t.CalendarYearMonth 
  from FactSubmission f
  inner join DimTime t on t.TimeKey = f.TimeKey
  order by f.Id asc
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/MAWC3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MAWC3.png" alt="enter image description here"></a></p>
  
  <p>Sorting from MDX we have descending</p>
  
  <pre><code>SELECT
  NON EMPTY ORDER(
   [DimTime.CalendarYearMonth].[CalendarYearMonth].Members,
   [DimTime.CalendarYearMonth].CurrentMember.Properties("MEMBER_KEY"), 
   DESC
   )  ON COLUMNS
  FROM [PSE_FactSubmission]
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wIKxh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wIKxh.png" alt="enter image description here"></a></p>
  
  <p>And Ascending</p>
  
  <p><a href="https://i.stack.imgur.com/dcMp8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dcMp8.png" alt="enter image description here"></a></p>
  
  <p>The January dates aren't at the top of either sort, which suggests I'm sorting by the <code>FactSubmission.ID</code> key instead of <code>DimTime.CalendarYearMonth</code></p>
  
  <p>Is this how things are supposed to work? I'd like to pull back Jan,Feb,March. </p>
  
  <p>DimTime.CalendarYearMonthNum is a column with data in the form 201501,201502,201503 etc. Here's an attempt at using this column to to sort the CalendarYearMonth data. </p>
  
  <p><a href="https://i.stack.imgur.com/twdTE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/twdTE.png" alt="enter image description here"></a></p>
  
  <p>Debugging Query to Select Keys
  <a href="https://i.stack.imgur.com/lht1R.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lht1R.png" alt="enter image description here"></a></p>
  
  <p>NonEmpty Query
  <a href="https://i.stack.imgur.com/36mN3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/36mN3.png" alt="enter image description here"></a></p>