BLACK FRIDAY SALE – Unlock Up to 25% OFF on All Exam Prep! - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Google Associate Data Practitioner Exam - Topic 2 Question 31 Discussion

Posted by Carlee on Sep 29, 2026 at 04:59 PM

Your company has several retail locations. Your company tracks the total number of sales made at each location each day. You want to use SQL to calculate the weekly moving average of sales by location to identify trends for each store. Which query should you use?

A)

B)

C)

D)

Suggested Answer: C

To calculate the weekly moving average of sales by location:

The query must group by store_id (partitioning the calculation by each store).

The ORDER BY date ensures the sales are evaluated chronologically.

The ROWS BETWEEN 6 PRECEDING AND CURRENT ROW specifies a rolling window of 7 rows (1 week if each row represents daily data).

The AVG(total_sales) computes the average sales over the defined rolling window.

Chosen query meets these requirements:

Extract from Google Documentation: From 'Analytic Functions in BigQuery' (https://cloud.google.com/bigquery/docs/reference/standard-sql/analytic-function-concepts): 'Use ROWS BETWEEN n PRECEDING AND CURRENT ROW with ORDER BY a time column to compute moving averages over a fixed number of rows, such as a 7-day window, partitioned by a grouping key like store_id.' Reference: Google Cloud Documentation - 'BigQuery Window Functions' (https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls).


Get Premium Associate Data Practitioner Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
12 comments · newest first
JO
Johnetta 4 days ago
Option A is confusing. I’m not sure it captures the trend accurately.
LA
Laura 9 days ago
I prefer Option C. It has a clear structure for the weekly average.
LA
Lawrence 15 days ago
I think Option B looks good. It seems to calculate the moving average correctly.
LI
Lizbeth 20 days ago
I agree, C is the best choice here!
TH
Thaddeus 25 days ago
Option D seems too complicated for this.
LI
Lindsey 1 month ago
Wait, is it really that simple?
MA
Ma 1 month ago
Definitely going with Option A!
TA
Tamie 1 month ago
I think Option C looks solid for moving averages.
DA
Daisy 2 months ago
I’m leaning towards option D because it seems to have the right structure for calculating a weekly average, but I’m not completely confident.
JA
Jamey 2 months ago
I feel like option B looks familiar, but I’m uncertain if it includes the right grouping for each location.
NI
Nickolas 2 months ago
I remember practicing a similar question where we had to calculate averages over a time period. I think it might be option C, but I can't recall the exact syntax.
GW
Gwenn 2 months ago
I think we need to use a window function to calculate the moving average, but I'm not sure which option shows that correctly.
0/2000 characters

Save Cancel