title: MDX query to sum a measure for all columns/rows
body: <p>I have a cube that has:</p>
  
  <pre><code>DimEntity
  EntityID
  EntityName
  EntityLongName
  
  FactReturns
  TotalReturn
  </code></pre>
  
  <p>What I want to do is sum the TotalReturns between all combinations of entities, so the output is like this:</p>
  
  <pre><code>             NameA        NameB
  LongNameA    sum(A, 1)    sum(A, 2)
  LongNameB    sum(B, 1)    sum(B, 2)
  </code></pre>
  
  <p>(sum(A, 1) = sum(A, A), because EntityName "A" and EntityID "1" refer to the same entity)</p>
  
  <p>What I have now is this:</p>
  
  <pre><code>WITH MEMBER [Measures].[SumReturns] AS
      SUM([Dim Entity].[EntityID], [Measures].[TotalReturn])
  SELECT 
      [Dim Entity].[EntityName].Children ON COLUMNS,
      [Dim Entity].[EntityLongName].Children ON ROWS  
  FROM
      [Returns]
  WHERE
      [Measures].[SumReturns]
  </code></pre>
  
  <p>But this just gives me a table like this:</p>
  
  <pre><code>             NameA            NameB
  LongNameA    A.TotalReturn    null
  LongNameB    null             B.TotalReturn
  etc...
  </code></pre>
  
  <p>I am just learning MDX and having a real hard time understanding how this works. </p>