title: PowerPivot formula for row wise weighted average
body: <p>I have a table in <code>PowerPivot</code> which contains the logged data of a traffic control camera mounted on a road. This table is filled the velocity and the number of vehicles that pass this camera during a specific time(e.g. 14:10 - 15:25). Now I want to know that how can I get the average velocity of cars for an specific hour and list them in a separate table with 24 rows(hour 0 - 23) where the second column of each row is the weighted average velocity of that hour? A sample of my stat_table data is given below:  </p>
  
  <pre>
  count   vel         hour  
  -----   ---         ----  
  133     96.00237    15  
  117     91.45705    21  
  81      81.90521    6  
  2       84.29946    21  
  4       77.7841     18  
  1       140.8766    17  
  2       56.14951    14  
  6       71.72839    13  
  4       64.14309    9  
  1       60.949      17  
  1       77.00728    21  
  133     100.3956    6  
  109     100.8567    15  
  54      86.6369     9  
  1       83.96901    17  
  10      114.6556    21  
  6       85.39127    18  
  1       76.77993    15  
  3       113.3561    2  
  3       94.48055    2
  </pre>  
  
  <p>In a separate <code>PowerPivot</code> table I have 24 rows and 2 columns but when I enter my formula, the whole rows get updated with the same number. My formula is:<br>
  <code>=sumX(FILTER(stat_table, stat_table[hour]=[hour]), stat_table[count] * stat_table[vel])/sumX(FILTER(stat_table, stat_table[hour]=[hour]), stat_table[count])</code></p>