As the title suggests, I want to build a query which returns the date when the total cost of an account was greater than or equal to a certain value.

So far, I have made this: $query = 'SELECT campaign.start_date FROM campaign WHERE metrics.cost_micros >= 700 LIMIT 1'; which isn't right, as it doesn't return the date where $700 were spent, but rather the start date of the campaign that surpassed $700.

Any help or insights are appreciated. Thank you in advance

I tried: $query = 'SELECT segments.date FROM customer WHERE metrics.cost_micros >= 700';. Doesn't work due to segments.date needing to be in the WHERE clause, as well as other variations of this query as well as reading the Google Ads API documentation.

Tag:google-ads-api, google-docs-api

Only one comment.

  1. Sai Teja Makani

    You can keep an always true condition for segment.date in where class like below, it should work 100%

    SELECT segments.date FROM campaign_budget WHERE segments.date > '1990-01-01' AND metrics.cost_micros >= 700 LIMIT 1

    Best! Makanist

Add a new comment.