Forum Discussion

AlejandroVazque's avatar
2 years ago
Solved

Hand-authored queries workaround for WorldBank data

Hi All,  Appreciate your help. I'm trying to develop a schedule refresh report in PowerBI, that requires to remove any dynamic data source. This dynamic source comes from my query on World Bank dat...
  • Anonymous's avatar
    Anonymous
    2 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.