title: Rank() in bigquery
body: <p><br>
  I am trying to assign rank value based on count of products(eg prod 1 has count of 100 which is max should have rank 1, prod 2 the second highest count of 80 should have rank of 2 and so on ) has but when i execute below query i get an error saying - Field 'rank_' not found in table <br>. Please let me know where am i going wrong <br></p>
  
  <pre><code>SELECT
    ProdName,
    NoofProds,
    rank_
  FROM (
    SELECT
      ProdName,
      COUNT(ProdName) AS NoofProds,
      RANK() OVER (PARTITION BY ProdName ORDER BY NoofProds DESC) AS rank_
    FROM
      [prodtable]
    WHERE
      (STRFTIME_UTC_USEC(Timestamp,"%Y%m%d")) = (STRFTIME_UTC_USEC(DATE_ADD(CURRENT_TIMESTAMP(), -1, "day"), "%Y%m%d"))
    GROUP BY
      1,
      3
    ORDER BY
      2 DESC)
  GROUP BY
    1,
    2,
    3
  ORDER BY
    rank_ DESC
  </code></pre>