cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
andybisnut
Regular Visitor

Google Analytics and Power BI: immediate error after importing (valid dimension and metric combo)

Hi everyone,

 

When I import data from Google Analytics, it appears there's a bug. First off, to test this, I am importing pages (dimension) and pageviews (metric), which is a valid dimension and metric combination (it's not because I haven't chosen at least one measure, as the error implies).

 

When I click on "Navigation" in Applied Steps, I see this error: "Expression.Error: Google Analytics requires that at least one measure be specified." This error happens no matter what I import. Something broke, and it wasn't broken before. I am not sure whether it's a problem with Power BI or the Google Analytics API. Thanks for your help!

1 ACCEPTED SOLUTION

@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. 🙂

 

View solution in original post

9 REPLIES 9
Mbstrand
Frequent Visitor

PERFECT solution when none of the others didn't work.  Thanks!!

Anonymous
Not applicable

I am having this same problem. I successfully imported one measure and one dimension into my report. I am able to see the data. Now, when I go to Query Editor > Applied Steps > Navigation, I get this error message:

 

Expression.Error: Google Analytics requires that at least one measure be specified.

 

This error prevents me from clicking the gear icon next to Added Items (says "We cannot modify this step because there are errors in previous steps. Please resolve those errors first."), so I cannot get back to the measures & dimensions menu to select additional measures or dimensions.

 

This error doesn't make logical sense. I chose one measure ({Cube.AddMeasureColumn, "Sessions", "ga:sessions"}) and one dimension ({Cube.AddAndExpandDimensionColumn, "ga:date", {"ga:date"}, {"Date"}}). To state that I did not specify at least one measure is false.

 

It seems like Sessions and Date are very basic, and so compatibility should not be a problem.

 

Does anyone have insight on this problem?

 

-----------------------------

My Power BI Desktop version is: 2.51.4885.543 64-bit (October 2017)

v-yuezhe-msft
Microsoft
Microsoft

@andybisnut,

Which dimension do you select? Do you use the latest version of Power BI Desktop(2.51.4885.581)? I can connect to Google Analytics data in the latest version of Power BI Desktop, you can review the screenshot in my scenario.
1.JPG


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yuezhe-msft--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. 🙂

 

View solution in original post

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.

@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.

 

 Great solution. It works perfect! Just change your query exactly as on the picture.

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

 

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Kudoed Authors