title: Summing of averages
body: <p>SSAS 2012, AdventureWorks Tabular Model SQL 2012</p>
  
  <p>Having a hierarchy of some fields, want to list values from a measure per month in a year, then see average value for month, then sum these averages on all hierarchy levels up.</p>
  
  <p>Example: (all measures in table 'Internet Sales')</p>
  
  <pre><code>ComplexCalculation:=[Internet Total Sales]*[UnitPriceAvg]/1000
  UnitPriceAvg:=AVERAGE('Internet Sales'[Unit Price])
  AvgComplexCalculation:=AVERAGEX(VALUES('Date'[Month]), [ComplexCalculation])
  AverageAndSumComplexCalculation:=IF( ISFILTERED(Product[Product Name]), [AvgComplexCalculation], SUMX (VALUES (Product[Product Name]), [AvgComplexCalculation]))
  </code></pre>
  
  <p>Pivot Fields:</p>
  
  <pre><code>Filters: [Calendar Year] [2006]
  Rows: [Product Category Name],[Product SubCategory Name],[Model Name],[Product Name],[Month]
  Columns:
  Values: [AverageAndSumComplexCalculation]
  </code></pre>
  
  <p>Is it the right way of doing this? Noticed that when my "ComplexCalculation" measure becomes more and more complex it needs lot of time to calculate the values (causes timeout).</p>