Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Combining multiple Google Analytics Queries give different results

Hi,

 

I'm fairly new to PowerBI. I am trying to create a dashboard based on Google Analytics data through the GA API. For my report I need more than 10 metrics. I quickly noticed that the limit is set at 10 and thus would make things harder. I try to solve it by creating multiple GA queries and after that I would like to merge them. This seems to be allowed and thus could work. This is the idea:

 

Query 1: Date, Campaign name, Source/Medium, Sessions, Pageviews, Users, ExitPage, Goal completions, (and some more)

Query 2: Date, Campaign name, Source/Medium, Page, Device Category, Avg time on page, Gender

Query 3: Date, Campaign name, Source/Medium, Latitude, Longitude

 

I would expect these queries to be of the same lenght (same # rows) as I use several similar dimensions. However, they are all of different sizes. This makes merging the queries impossible as I have a lot of null data. 

 

I also checked if the big queries display the same numbers as GA itself. It does not. Image below displays on the left a query with only Pageviews and on the right a query combined with other metrics (Query 1):

 

The number on the left is identical to GA.com but the right is not.

 

What should I do differently? 

5 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi Anonymous 

     

    Did you select the first three columns as matching columns when you merged the queries? And which Join Kind did you pick? If one query returns a row number which is identical to GA.com, you could consider putting it in the left side, then select Left Outer to merge additional columns from the second table. If Table1 has more rows than matched rows, it will display null in these additional columns of non-matched rows. You could also try other Join Kind which could meet your need.

     

    Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as the solution to help other members find it.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the reply.

      I think the merge works as intended. But it goes wrong with the initial load of the seperate GA queries. Right now I used a Left Outer join. 

       

      See, I would expect the seperate queries to be of the same size, which would lead to having 0 null values when merging. I suspect that the GA load leaves out some data depending on what dimensions are being called.

       

      For example: I have 2 GA queries which both contain at least Date, Campaign, Source/Medium AND Sessions (both queries contain more than these). I would expect both queries to be off the same size because both contain date and sessions, however. Query 1 has 2367 rows, while query 2 has 23715 rows. Now when i Merge this it obviously gives me null values, but this shouldnt be the case in my thought.

       

      How can I make sure that both queries are of the same length and thus can be merged?

      • v-jingzhang's avatar
        v-jingzhang
        Community Support

        Hi Anonymous 

         

        It seems weird. If you are connecting to the same data source for these separate queries, they should have the same number of rows. How do you create these separate queries? Can you share their M codes from the Advanced Editor? Remove sensitive info in these M codes.

         

        Regards,

        Jing