Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Bane313
New Member

Google Analytics API returning wrong event counts

Hello everyone. 

I'm using the Google Analytics API (v2.0 beta) to build some reports in PowerBI Desktop. I'm still pretty new to PowerBI, so I'm sure the error is on my end, but I'd appreciate any help I can get. 

 

I have 3 tables in my report. One is a dimension table that includes the "hostname" dimension, the "eventname" dimension (text filtered to include the word "helpful" which should return the events "helpful" and "not_helpful"), and the event count metric. Another dimension table that includes "hostname", "month", "year", and "bouncerate", "newusers","totalusers", and "userengagementduration". The final table is a fact table that includes "hostname". The relationship from both of the dimension tables to the fact table is "hostname".

Bane313_0-1701960264717.png

In the Helpful/Nothelpful table, I have 3 custom measures:

  • one called "feedback total" with the formula of 

feedback total = calculate(sum('Helpful/not helpful'[eventCount]),'Helpful/not helpful'[Helpful event]="helpful"||'Helpful/not helpful'[Helpful event]="not_helpful")

  • One called "helpful total" with the formula of
helpful total = calculate(sum('Helpful/not helpful'[eventCount]),'Helpful/not helpful'[Helpful event]="helpful")
  • One called "% Positive Feedback" with the formula of:
% Positive Feedback = divide('Helpful/not helpful'[helpful total], [feedback total])
 
When I try to make the Matrix with the following options, my event count for the "helpful" and "nothelpful" events are way off.

Bane313_1-1701960571024.png

Bane313_2-1701960601163.png

I'd imagine that the error is coming at the table level for my "helpful/nothelpful" table. My query looks like this:

 

let
Source = GoogleAnalytics.Accounts([Implementation="2.0"]),
#"accounts/XXXXXXXXX" = Source{[Id="accounts/XXXXXXXX"]}[Data],
#"properties/XXXXXXXX" = #"accounts/XXXXXXXX"{[Id="properties/XXXXXXXX"]}[Data],
#"properties/1" = #"properties/XXXXXXXXX"{[Id="properties/XXXXXXXX"]}[Data],
#"Added Items" = Cube.Transform(#"properties/1",
{
{Cube.AddAndExpandDimensionColumn, "eventName", {"eventName"}, {"eventName"}},
{Cube.AddAndExpandDimensionColumn, "hostName", {"hostName"}, {"hostName"}},
{Cube.AddMeasureColumn, "eventCount", "eventCount"}
}),
#"Removed Errors" = Table.RemoveRowsWithErrors(#"Added Items", {"eventName"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Errors", each Text.Contains([eventName], "helpful")),
#"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"eventName", "Helpful event"}})
in
#"Renamed Columns"

 

 

What am I doing wrong? Any help would be immensely appreciated!

0 REPLIES 0

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.