Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

How to apply sampling parameter to Google Analytics query?

Hello,

I'm connecting to Google Analytics via Power BI connector.  When I'm adding default channel grouping the values between GA and Power BI do not match (see below).

 

 

The issues has already been discussed here and here. What was discovered it these topics was that probably data sampling is creating the issue. You can change the data sampling behaviour by setting the sampling level parameter in the query (documentaion).

 

The question is what is the correct syntax to setup parameter samplingLevel=HIGHER_PRECISION in Power Query?

 

Thanks, 

Kamil

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    I can't seem to reproduce your issue.

     

    I have seen what others have written about parameter samplingLevel=HIGHER_PRECISION in Power Query. Please try it to see if it helps you.

    let
    Source = GoogleAnalytics.Accounts(),
    #"xxxxxxxx" = Source{[Id="xxxxxxxx"]}[Data],
    #"UA-xxxxxxxx-1" = #"xxxxxxxx"{[Id="UA-xxxxxxxx-1"]}[Data],
    #"yyyyyyyy" = #"UA-xxxxxxxx-1"{[Id="yyyyyyyy"]}[Data],
    #"samplingLevel" = HIGHER_PRECISION,
    #"Added Items" = Cube.Transform(#"81471935",
    {
    {Cube.AddAndExpandDimensionColumn, "ga:date", {"ga:date"}, {"Date"}},
    {Cube.AddMeasureColumn, "Users", "ga:users"}
    }),
    #"Filtered Rows" = Table.SelectRows(#"Added Items", each [Date] >= #date(2017, 1, 1) and [Date] < #date(2030, 1, 1))
    in
    #"Filtered Rows"

     

    Please refer to the following topic for more information.

    https://community.powerbi.com/t5/Desktop/Problem-with-Google-Analytics-data/td-p/965367

     

    Best Regards

    Community Support Team _ polly

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.