Forum Discussion

c_cook28954's avatar
c_cook28954
Icon for Advocate II rankAdvocate II
3 years ago

Power Bi to Google Analytics (UA) Expression.Error

Hi all, 

 

I'm having an issue pulling data into Power Bi from Google Analytics (UA) where certain data selections, primarily data I'm trying to pull from the DoubleClick folders available from Google, produce the below error: 

 

I've looked everywhere for a solution but haven't found anything that exactly addresses this situation - I've found a few that are similar, such as the two shown below, but neither solution applied exactly to the situation I encountered and, when I attempted them, neither solved the problem.

1. https://community.powerbi.com/t5/Power-Query/Google-Analytics-and-Power-BI-immediate-error-after-importing/td-p/277181

2. https://www.reddit.com/r/PowerBI/comments/q8jsgd/powerbi_connceting_to_google_analytics/ (Understand that this isn't necessarily the best source but it did have the exact Expression.Error phrase that I encountered just no direct solution unforunately)

 

It's worth mentioning that I'm still able to pull data through from other folders from Power Bi such as Page Tracking using information from Time to do so. You'll find the advanced query below for reference: 

________________________________________________

let
Source = GoogleAnalytics.Accounts(),
#"XXXXXXXX" = Source{[Id="XXXXXXXX"]}[Data],
#"UA-XXXXXXXX-X" = #"XXXXXXXX"{[Id="UA-XXXXXXXX-X"]}[Data],
#"XXXXXXXX" = #"UA-XXXXXXXX-X"{[Id="XXXXXXXX"]}[Data],
#"Added Items" = Cube.Transform(#"XXXXXXXX",
{
{Cube.AddAndExpandDimensionColumn, "ga:date", {"ga:date"}, {"Date"}},
{Cube.AddMeasureColumn, "Avg. Time on Page", "ga:avgTimeOnPage"},
{Cube.AddMeasureColumn, "Pageviews", "ga:pageviews"},
{Cube.AddMeasureColumn, "Unique Pageviews", "ga:uniquePageviews"}
})
in

#"Added Items"

________________________________________________

 

I've also tried testing the relationship that I was attempting to use - Date (from Time) & Clicks (from DoubleClick Campaign Manager) - in the UA Dimensions and Metrics explorer (linked below) and everything looked fine.

https://ga-dev-tools.google/dimensions-metrics-explorer/

 

You'll find a copy of the query that wasn't working below for reference as well:

________________________________________________

let
Source = GoogleAnalytics.Accounts(),
#"XXXXXXXX" = Source{[Id="XXXXXXXX"]}[Data],
#"UA-XXXXXXXX-X" = #"XXXXXXXX"{[Id="UA-XXXXXXXX-X"]}[Data],
#"XXXXXXXX" = #"UA-XXXXXXXX-X"{[Id="XXXXXXXX"]}[Data],
#"Added Items" = Cube.Transform(#"XXXXXXXX",
{
{Cube.AddAndExpandDimensionColumn, "ga:date", {"ga:date"}, {"Date"}},
{Cube.AddMeasureColumn, "CM Clicks", "ga:dcmClicks"}
})
in
#"Added Items"

________________________________________________

 

You'll find my Power BI version number listed below for reference: 

 

Thanks in advance

1 Reply

  • Hi, c_cook28954 were you able to find a solution? I've used the GA native connector but had some issues with my connection sometimes. As a workardound, maybe you can try to test your connection with a 3rd party connector. I've tried windsor.ai, supemetrics and funnel.io. I stayed with windsor because it is much cheaper so just to let you know other options. Also, you may consider migrating to GA4 since GA UA is dead now