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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Add Google Analytics Custom Segment

Hi, 

 

I am trying to get some Google Analytics data into PowerBI, however I need to filter it for a specific segment. I was searching the web for an answer, but could not find anything relevant. 

 

In essence, I need to filter everything for this: sessions::condition::ga:orderCode==XX11XX2X [or gaid:xxxxxxxxxxxxxxxxx] (taken from G.A. query explorer)

 

Query below if it helps:

 

let Multiple =(id1 as text,id2 as text,id3 as text)=>
let
Source = GoogleAnalytics.Accounts(),
#"11111111" = Source{[Id=id1]}[Data],
#"XX-11111111-1" = #"11111111"{[Id=id2]}[Data],
#"11111111" = #"XX-11111111-1"{[Id=id3]}[Data],
#"Added Items" = Cube.Transform(#"11111111",
{
{Cube.AddAndExpandDimensionColumn, "ga:yearMonth", {"ga:yearMonth"}, {"yyyymm"}},
{Cube.AddMeasureColumn, "Sessions", "ga:sessions"},
{Cube.AddMeasureColumn, "Bounces", "ga:bounces"},
{Cube.AddMeasureColumn, "Transactions", "ga:transactions"},
{Cube.AddMeasureColumn, "BounceRate", "ga:bounceRate"}
}),
#"Filtered Rows" = Table.SelectRows(#"Added Items", each [yyyymm] >= 201701)

in
#"Added Items"
in Multiple

 

Any help will be appreciated.

 

Thx ! 

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi sailor321,

 

Both GA connector and Web.Contents() don't support custom segment in power query currently because post request in Web.Contents() function doesn't support OAuth2. In addtion, it's still a requested feature, please refer to this idea. As a workaround, you may use python or R script to achieve the filtered data from GA and then import the data into power bi.

 

Regards,

Jimmy Tao

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors