llooker / google_ga360

Looker Blocks for Google Analytics 360
MIT License
39 stars 51 forks source link

Add "Average pageview to purchase" - do as filtered measure rather than DT #12

Open DillonMorrison opened 6 years ago

DillonMorrison commented 6 years ago

SELECT ( SUM(total_pagesviews_per_user) / COUNT(users) ) AS avg_pageviews_per_user FROM ( SELECT fullVisitorId AS users, SUM(totals.pageviews) AS total_pagesviews_per_user FROMbigquery-public-data.google_analytics_sample.ga_sessions_* WHERE _TABLE_SUFFIX BETWEEN '20170701' AND '20170731' AND totals.transactions >=1 GROUP BY users )