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
andrea_chiappo
Helper III
Helper III

parameterise data extraction from Google Analytics

I have access to Google Analytics data of a website (obtained through tagging imposed by the website's developer). 

Here I have a access to several sections of the "property".

 

In my case I am interested in GA data from two sections: the website and the blog.

For both I need to perform the same extractions, creating the same Dimension tables and so forth...

Hence, I perform the same extractions twice, while they look the same differing only in the top lines,

which look something like this:

 

let
        Source = GoogleAnalytics.Accounts(),
        #"11223344" = Source{[Id="11223344"]}[Data],
        #"UA-11223344-2" = #"11223344"{[Id=UA-11223344-2]}[Data],
        #"556677889" = #"UA-11223344-2"{[Id="556677889"]}[Data],
        #"Added Items" = Cube.Transform(#"556677889",

(for the website)

 

and 

 

let

        Source = GoogleAnalytics.Accounts(),
        #"11223344" = Source{[Id="11223344"]}[Data],
        #"UA-11223344-4" = #"11223344"{[Id="UA-11223344-4"]}[Data],
        #"566778899" = #"UA-11223344-4"{[Id="566778899"]}[Data],
        #"Added Items" = Cube.Transform(#"566778899",

(for the blog)

 

I thought of creating two new parameters, with two possible values each, to be chosen from a list. 

Following the example above: 

param1 = "UA-11223344-2" or "UA-11223344-2"

param2 = "556677889" or "566778899"

then putting a condition (using M) to pick ether one or the other value of param2 in line 5, depending on the value of param1.

 

However, despite correctly recognising the parameter value, Power Query returns the following error:

 

Expression.Error: The key didn't match any rows in the table.
Details:
    Key=
        Id="UA-11223344-2"
    Table=[Table]

 

Does anybody know a way to solve this issue? Thank you

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @andrea_chiappo 

Is this problem sloved? 
If it is sloved, could you kindly accept it as a solution to close this case and help the other members find it more quickly?
If not, please feel free to let me know.
 
Best Regards
Maggie
v-juanli-msft
Community Support
Community Support

Hi @andrea_chiappo 

Firstly, connect to the data source and open the advanced editor, you would get codes as below:

let
        Source = GoogleAnalytics.Accounts(),
        #"11223344" = Source{[Id="11223344"]}[Data],
        #"UA-11223344-2" = #"11223344"{[Id=UA-11223344-2]}[Data],
        #"556677889" = #"UA-11223344-2"{[Id="556677889"]}[Data],
        #"Added Items" = Cube.Transform(#"556677889",

Change it to the following:

let
        Source = GoogleAnalytics.Accounts(),
        step1 = Source{[Id="11223344"]}[Data],
        step2= step1{[Id=parameter1]}[Data],
        step3 = step2{[Id=parameter2]}[Data],
        #"Added Items" = Cube.Transform(step3,

meanwhile, create two parameter:

parameter1, parameter2

 

Best Regards

Maggie

I tried this but it didn't work

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.

Top Solution Authors