title: How to compare Individual data to aggregate group by in Google Query (SQL)?
body: <p>I have a table like this, with the current table in blue, and the desired results highlighted in yellow:</p>
  
  <p><img src="https://i.stack.imgur.com/hhAsa.png" alt="Picture of Example Table"></p>
  
  <p>And my goal is to set up a query in Google Sheets using their built-in <code>=QUERY()</code> function (note: based on the Google's own Query language, which is very similar to SQL) that can essentially do this entire table, without adding extra formulas. I know how to find the monthly averages separately, in a style like</p>
  
  <pre><code>SELECT month(DateRun), average(metric) GROUP BY month(DateRun)
  </code></pre>
  
  <p>But how could you have it so it's like </p>
  
  <pre><code>SELECT AdID, DateRun, Metric, average(Metric for Associated Month), IndividualMetric - AverageForMonth 
  </code></pre>
  
  <p>I have tried to find it on my own, but have not been able to find a resource that I'm able to transform for my own usage.</p>
  
  <p>I learned sub-queries a while back, and have a feeling that maybe the answer to this but I am very lost. </p>
  
  <p>Please let me know if I can provide any additional information.</p>