Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I am using Bing API to get Latitude and Longitude of Country only and It seems to loop through every possible region. I based my api call off https://sqldusty.com/2016/04/26/power-bi-and-the-bing-maps-api/
The Country column is from my table, I don't understand why I am getting multiple results?
If anyone could kindly assist that would be most helpful.
Example:
The only parameter "country" so I figured that I could use "countryRegion" in my code. Here is the code:
let PointLookup = (country as text) =>
let
Source = Xml.Tables(Web.Contents("http://dev.virtualearth.net/REST/v1/Locations/countryRegion="&country&"?o=xml&key=2D7Fw69q3CPBOs815sRV~")),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Copyright", type text}, {"BrandLogoUri", type text}, {"StatusCode", Int64.Type}, {"StatusDescription", type text}, {"AuthenticationResultCode", type text}, {"TraceId", type text}}),
#"Expanded ResourceSets" = Table.ExpandTableColumn(#"Changed Type", "ResourceSets", {"ResourceSet"}, {"ResourceSets.ResourceSet"}),
#"Expanded ResourceSets.ResourceSet" = Table.ExpandTableColumn(#"Expanded ResourceSets", "ResourceSets.ResourceSet", {"EstimatedTotal", "Resources"}, {"ResourceSets.ResourceSet.EstimatedTotal", "ResourceSets.ResourceSet.Resources"}),
#"Expanded ResourceSets.ResourceSet.Resources" = Table.ExpandTableColumn(#"Expanded ResourceSets.ResourceSet", "ResourceSets.ResourceSet.Resources", {"Location"}, {"ResourceSets.ResourceSet.Resources.Location"}),
#"Expanded ResourceSets.ResourceSet.Resources.Location" = Table.ExpandTableColumn(#"Expanded ResourceSets.ResourceSet.Resources", "ResourceSets.ResourceSet.Resources.Location", {"Name", "Point", "BoundingBox", "EntityType", "Address", "Confidence", "MatchCode", "GeocodePoint"}, {"ResourceSets.ResourceSet.Resources.Location.Name", "ResourceSets.ResourceSet.Resources.Location.Point", "ResourceSets.ResourceSet.Resources.Location.BoundingBox", "ResourceSets.ResourceSet.Resources.Location.EntityType", "ResourceSets.ResourceSet.Resources.Location.Address", "ResourceSets.ResourceSet.Resources.Location.Confidence", "ResourceSets.ResourceSet.Resources.Location.MatchCode", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint"}),
#"Expanded ResourceSets.ResourceSet.Resources.Location.GeocodePoint" = Table.ExpandTableColumn(#"Expanded ResourceSets.ResourceSet.Resources.Location", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint", {"Latitude", "Longitude", "CalculationMethod", "UsageType"}, {"ResourceSets.ResourceSet.Resources.Location.GeocodePoint.Latitude", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint.Longitude", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint.CalculationMethod", "ResourceSets.ResourceSet.Resources.Location.GeocodePoint.UsageType"})
in
#"Expanded ResourceSets.ResourceSet.Resources.Location.GeocodePoint"
in PointLookup
The other entries are cities/towns/villages that happen to have the same name as a country.
I understand, I thought "CountryRegion" would just bring the country name but it looks like it's finding more than that. I tried the google api but now you need a subsciption so now trying with Bing.