title: Windowed sum query giving a "because it is not contained in either an aggregate" error
body: <p>I have the following query:</p>
  
  <pre><code>        select  d.ShortDate, 
                      b.BranchCode,
                      sum(home_net_change_calc) as Period_HomeNet_Denom,
                      sum(oper_net_change_calc) as Period_OperNet_Denom,
  
                      sum(budget_home_net_change_calc) as Period_BudgetHomeNet_Denom,
                      sum(budget_oper_net_change_calc) as Period_BudgetOperNet_Denom,
  
                      sum(oper_net_change_calc) over (partition by b.BranchCode order by d.ShortDate rows between unbounded preceding and current row  ) as Range_HomeNet_Denom
  
                   from FinanceFacts as fact
                     join DimBranch b on fact.BranchKey = b.BranchKey
                     join DimDate d on d.DateKey = fact.DateKey
                  where d.ShortDate between '2016-09-01' and '2017-09-30' 
                      and b.BranchCode = '113'
                  group by d.ShortDate, 
                      b.BranchCode
  </code></pre>
  
  <p>And the line with the windowed sum function causes the error: Column 'FinanceFacts.oper_net_change_calc' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.</p>
  
  <p>This doesn't make any sense to me - I am trying to SUM that field, not group by it??</p>
  
  <p>The goal of the query, if it isn't clear, is to sum measures for each ShortDate value, and then also get a total value over all the dates.</p>
  
  <p>I am using SQL Server 2014</p>