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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.