title: Calculate window function against another in same column
body: <p>Hi I am using SQL server. I have a set of data and I am trying to use window functions to count the instances of something. I am then running the window function again and dividing it against a row count window function to try and get an average. However, I keep getting 0. Is it possible to run a window function against another in the same column?</p>
  
  <pre><code>COUNT(city) OVER (partition by state)/Count(*) over (partition by total)*100 AS AVG
  </code></pre>
  
  <p>is something like this possible? When i break it apart and run each individually it works, but when i combine them i get 0 in the column</p>