Forum Discussion
Google Analytics and Power BI: immediate error after importing (valid dimension and metric combo)
- Anonymous8 years ago
Anonymous,
I have figured out a workaround. It involes simply using the advanced editor within the query editor to manually add additional dimensions and/or metrics. Note that you need to know the API names of the dimensions and metrics, which you can browse here: https://developers.google.com/analytics/devguides/reporting/core/dimsmets
I took a video of my workaround. I simply go into the query editor, go to the Source step within Applied Steps, and then go into the advanced editor. Then I copy and paste, and simply change the names to the dimensions/metrics I want to add. The video explains it better. :)
Anonymous--this error happens even when I choose a valid metric dimension combination. No matter what I choose, I get the error if I try to go back and make edits. I have captured a video of what I'm seeing. Please note that I am not showing the GA account selection portion, because we have multiple clients whose GA accounts we manage. So prior to the video, I clicked on Get Data > Online Services > Google Analytics, and then drilled into a GA account/property/view, and that's where the video picks up. Please note this error is not GA property/view specific. It happens no matter the GA property/view I'm pulling data from.
Anonymous,
I have figured out a workaround. It involes simply using the advanced editor within the query editor to manually add additional dimensions and/or metrics. Note that you need to know the API names of the dimensions and metrics, which you can browse here: https://developers.google.com/analytics/devguides/reporting/core/dimsmets
I took a video of my workaround. I simply go into the query editor, go to the Source step within Applied Steps, and then go into the advanced editor. Then I copy and paste, and simply change the names to the dimensions/metrics I want to add. The video explains it better. :)
- bsimser7 years agoNew Member
This doesn't solve the error so shouldn't be a solution or a workaround. I'm having the same problem and get the error message in Power BI "Expression.Error: Google Analytics requires that at least one measure be specified." on the Navigation step after adding a source with multiple values (like the original poster).
This solution (to use the advanced editor) to add additional metrics is fine if you end up with the error on the first step, but that's caused by only picking one dimension in your original query (which right now, Power BI won't even let you do and prevents you from importing the data to start with).
It's simple to reproduce and doesn't seem to be fixed.
1. Import a few columns from a GA connection (I have 6 AddAndExpandDimensionColumns and 3 AddMeasureColumns)
2. You'll have a query with three steps: Source, Navigation, and Added Items
3. Click on the Navigation step and you see this error.
The navigation code step is:
= #"UA-XXXXXXXX-X"{[Id="XXXXXXXX"]}[Data]
Where the first part is your property name in GA and the ID is your application number.
(you can see these numbers in the advanced editor when looking at the Source step)
So yes, this is still a problem and you can't fix it (at least with the steps in the video provided) and it prevents you from clicking on the gear icon in any step after the Navigation one.
I'm using Power BI desktop 2.67.5404.589
- bsimser7 years agoNew Member
Just a follow up as I wanted to post my Source step so here it is (with the numbers scrubbed)
let Source = GoogleAnalytics.Accounts(), #"xxxxxxxx" = Source{[Id="xxxxxxxx"]}[Data], #"UA-xxxxxxxx-3" = #"xxxxxxxx"{[Id="UA-xxxxxxxx-3"]}[Data], #"xxxxxxxx" = #"UA-xxxxxxxx-3"{[Id="xxxxxxxx"]}[Data], #"Added Items" = Cube.Transform(#"xxxxxxxx", { {Cube.AddAndExpandDimensionColumn, "ga:pagePath", {"ga:pagePath"}, {"Page"}}, {Cube.AddAndExpandDimensionColumn, "ga:pagePathLevel1", {"ga:pagePathLevel1"}, {"Page path level 1"}}, {Cube.AddAndExpandDimensionColumn, "ga:pageTitle", {"ga:pageTitle"}, {"Page Title"}}, {Cube.AddAndExpandDimensionColumn, "ga:date", {"ga:date"}, {"Date"}}, {Cube.AddAndExpandDimensionColumn, "ga:hour", {"ga:hour"}, {"Hour"}}, {Cube.AddAndExpandDimensionColumn, "ga:source", {"ga:source"}, {"Source"}}, {Cube.AddMeasureColumn, "Pageviews", "ga:pageviews"}, {Cube.AddMeasureColumn, "Sessions", "ga:sessions"}, {Cube.AddMeasureColumn, "Unique Pageviews", "ga:uniquePageviews"} }) in #"Added Items"So I definitely have more than one dimension selected but the error is there right after adding this as a source.
- Anonymous6 years agoNot applicable
@bsimer
Not sure if you ever fixed this - I see your last post was some time ago. But I thought I'd post the solution I found here in case you or anyone else encoutners this issue.
As you noted, sometimes the problem happens when you definitely have valid dimensions and metrics in the query. The error happens at the "Navigation" step of the query, before the part of the query where dimensions or metrics are added at all.
It seems the problem is being causing the navigation step because PowerBI doesn't seem to accept the multiple variable assignments to drill down from GA account->property->view
If you open the Advanced Editor, you should see something like this (I have changed the actual account, property and view numbers of my GA to XXXs, YYYs and ZZZs):
https://i.imgur.com/7gePwJK.png
My fix was to change the code here so that instead of having these three different variables in different steps, the entire navigation down the three different levels of ID was done in the "Cube.Transform" step. So your final version should look like this:
https://i.imgur.com/n4xgO5R.png
This seems to resolves the issue.
Sorry those images are links and not embedded - this forum didn't seem to like me embedding the images in the post.
- Kirill_Moscow6 years agoNew Member
Great solution. It works perfect! Just change your query exactly as on the picture.