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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
warrencowan
Kudo Collector
Kudo Collector

Google analytics - modify query to include custom segment ID?

I am pullign data from GA using the desktop connector,

 

but have encountered its inability to access my custom segments as a means of filtering the data its requesting.

 

Is there a way to manually specify the ID of my custom segment in the query, via the advanced query editor or even a way to write a custom query. 

 

Many thanks in advance...query below if it helps

 

let
Source = GoogleAnalytics.Accounts(),
#"xxxxxx" = Source{[Id="xxxxxx"]}[Data],
#"UA-xxxxxx-1" = #"xxxxxx"{[Id="UA-xxxxxx-1"]}[Data],
#"xxxxxxxx" = #"UA-xxxxxx-1"{[Id="xxxxxxxx"]}[Data],
#"Added Items" = Cube.Transform(#"xxxxxxxx", {{Cube.AddAndExpandDimensionColumn, "ga:transactionId", {"ga:transactionId"}, {"Transaction ID"}}, {Cube.AddMeasureColumn, "Revenue", "ga:transactionRevenue"}, {Cube.AddAndExpandDimensionColumn, "ga:date", {"ga:date"}, {"Date"}}}),
#"Filtered Rows" = Table.SelectRows(#"Added Items", each Date.IsInPreviousNDays([Date], 5))
in
#"Filtered Rows"

1 REPLY 1
DuncanP
Advocate II
Advocate II

Hi @warrencowan

 

Did you ever manage to get this to work? I'm trying to do the same thing but without much success so far.

 

Best,

 

Duncan

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.