Skip to content

Instantly share code, notes, and snippets.

@dwsmart
Created September 15, 2025 15:57
Show Gist options
  • Save dwsmart/acae316266612e8bc99945f94a208b06 to your computer and use it in GitHub Desktop.
Save dwsmart/acae316266612e8bc99945f94a208b06 to your computer and use it in GitHub Desktop.
Get impressions and average impressions
SELECT SUM(impressions) as impressions,
SUM(sum_position) / SUM(impressions) as ave_pos
FROM `{your_project_here}.searchdata_url_impression` WHERE
data_date >= PARSE_DATE('%Y%m%d', '20250907')
AND data_date <= PARSE_DATE('%Y%m%d', '20250913')
## uncomment next line to see impressions where the average position is greater than, as BQ counts from Zero,
## subtract 1 so for greater than 10, have > 9
# AND sum_position / impressions > 9
## for less than uncomment this line same minus 1 rule applies,so for ave pos in the top 10 you want <= 9
# AND sum_position / impressions <= 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment