1 Reply Latest reply on Nov 15, 2018 3:20 PM by patrick.byrne.0

    Query Google Analytics working in Bigquery but not in Tableau

    Pitchstar Chernenko

      I want to get session from Google Analytic and display them in Tableau. Attached is my Standard SQL queries:

      with subQ_googleanalytic as(
      select parse_date("%Y%m%d",date) as GA_date
      ,COUNT(DISTINCT CONCAT(CAST(fullvisitorid AS string),CAST(visitid AS string))) AS no_sessions
      from `43864393.ga_sessions_*`
      , unnest(hits) as hits
      where _TABLE_SUFFIX between
      FORMAT_DATE("%Y%m%d", DATE_SUB(CURRENT_DATE(), INTERVAL 2 DAY)) AND
      FORMAT_DATE("%Y%m%d", DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY))
      and totals.visits = 1 --The value is null if there are no interaction events in the session.
      and hits.page.hostname is null
      group by 1)
      
      
      select *
      from subQ_googleanalytic
      

      The query run successfully in Bigquery. However, i cannot paste the query into my Tableau. Tableau said:

      An error occurred while communicating with the data source.

       

       

       

       

      The Google BigQuery service was unable to compile the query.

      Syntax error: Expected ")" but got end of statement at [1:643]

      I am using tableau desktop 2018.2. How do i resolve this?

      Many thanks!

       

      Message was edited by: Pitchstar Chernenko - Fix the title