ericbrownaustin
ericbrownaustin

Reputation: 1330

Google Analytics BigQuery Export: Getting Different Number for Revenue

I'm trying to query for the transaction totals with the intention to match the interface. Google Analytics has a demo account that I am using for my testing. The data for this account can also be accessed in BigQuery.

When I run the following query:

SELECT date,
SUM(totals.transactionRevenue/1000000) AS revenue,
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`
WHERE _TABLE_SUFFIX BETWEEN '20160801' AND '20160801'
GROUP BY date

I get this:

Row  date       revenue
1    20160801   6116.0599999999995

This differs from the results I get out of the interface which is $6,098.47. Rounding error aside, I expect the number to match. This is similar behavior to what I see in data for my own Google Analytics tables.

Upvotes: 1

Views: 735

Answers (1)

Martin Weitzmann
Martin Weitzmann

Reputation: 4746

You're using a deprecated field. try totals.totalTransactionRevenue instead:

SELECT 
  date,
  SUM(totals.totaltransactionRevenue/1000000) AS revenue,
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`
WHERE _TABLE_SUFFIX BETWEEN '20160801' AND '20160801'
GROUP BY date

Upvotes: 3

Related Questions