Forum Discussion
Hand-authored queries workaround for WorldBank data
- Anonymous2 years ago
Hi AlejandroVazque - the following step is the cause of the Dynamic Query warning:
#"Personnalisée ajoutée" = Table.AddColumn(#"Type modifié1", "Personnalisé", each Xml.Tables(Web.Contents("http://api.worldbank.org/v2/country/all/indicator/NY.GNP.PCAP.PP.CD?date=2000:2022&page="&[Column1])))This step effectively creates a unique URL call. This makes Power Query think that Credentials are required for each unique call. To avoid the issue you need to use "RelativePath" feature of Web.Contents - PowerQuery M | Microsoft Learn. See the example in step one.
To correct the query I would recommend the following two changes:
let #"Base URL" = "http://api.worldbank.org/v2/", Source = Xml.Tables( Web.Contents( #"Base URL", [ RelativePath= "country/all/indicator/NY.GNP.PCAP.PP.CD", Query = [date = "2000:2022"] ] )),Then
#"Personnalisée ajoutée" = Table.AddColumn(#"Type modifié1", "Personnalisé", each Xml.Tables( Web.Contents( #"Base URL", [ RelativePath= "country/all/indicator/NY.GNP.PCAP.PP.CD", Query= [ date = "2000:2022", page = [Column1] ] ] ) ) ),This way Power BI will only want to store credentials for the Base URL.
Hi AlejandroVazque - the following step is the cause of the Dynamic Query warning:
#"Personnalisée ajoutée" = Table.AddColumn(#"Type modifié1", "Personnalisé", each Xml.Tables(Web.Contents("http://api.worldbank.org/v2/country/all/indicator/NY.GNP.PCAP.PP.CD?date=2000:2022&page="&[Column1])))This step effectively creates a unique URL call. This makes Power Query think that Credentials are required for each unique call. To avoid the issue you need to use "RelativePath" feature of Web.Contents - PowerQuery M | Microsoft Learn. See the example in step one.
To correct the query I would recommend the following two changes:
let
#"Base URL" = "http://api.worldbank.org/v2/",
Source = Xml.Tables( Web.Contents( #"Base URL",
[
RelativePath= "country/all/indicator/NY.GNP.PCAP.PP.CD",
Query = [date = "2000:2022"]
]
)),Then
#"Personnalisée ajoutée" = Table.AddColumn(#"Type modifié1", "Personnalisé", each
Xml.Tables(
Web.Contents( #"Base URL",
[
RelativePath= "country/all/indicator/NY.GNP.PCAP.PP.CD",
Query= [ date = "2000:2022", page = [Column1] ]
]
)
)
),This way Power BI will only want to store credentials for the Base URL.
Thanks Daryl-LyunchèBzy, the relative path proposal has worked perfectly