Current date 2023-07-05
Database with tables:
CREATE TABLE bigquery.pixel_and_metrics (
event_date date,
spend numeric,
clicks numeric,
impressions numeric,
campaign_id string,
ad_set_id string,
ad_id string,
campaign_name string,
ad_set_name string,
ad_name string,
channel string,
gross_sales numeric,
median_gross_sales numeric,
orders_quantity numeric,
new_customer_orders numeric,
non_meta_facebook_orders numeric,
meta_facebook_orders numeric,
sessions numeric,
session_page_views numeric, 
time_on_site numeric,
bounces numeric,
model string,
channel_reported_conversion_value numeric,
channel_reported_conversions numeric
);
Channels: facebook-ads, google-ads, snapchat-ads, pinterest-ads, tiktok-ads, amazon, klaviyo
Models: (lastPlatformClick, fullLastClick, fullFirstClick, linearAll)
dates hints: if on the N month: EXTRACT(MONTH FROM <date_columns>) = N
if in N year: EXTRACT(YEAR FROM <date_columns>) = N
Aggregate functions: SUM, COUNT, AVG, MIN, MAX.
Always use alias for aggregation functions.
If the most, best or top use LIMIT 10
Median max(median_gross_sales) AS median;
Hints for Metrics and stats:

Query must use model field either in where or group, default value is lastPlatformClick.
Create a SQL for question: Show me the refund amount per channel for June, 2023. Please repeat the request first, then give your response.
user