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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Silko
Helper II
Helper II

Mapping - get location country

Is it possible to get location country out of location string which doesn't include a country. Let's say I have a column of locations and I want to add a custom column with location country which I want to get from locations column. For example:

  • I have a value "Paris" in locations column
  • in location country column I want to get "France"
4 REPLIES 4
Anonymous
Not applicable

You need more than city to get a country.  A city is not unique across a country (ex: Paris, IL USA).  Your string, at the minimum, should contain the City and State/Region.  There are paid services that will give you a list of every Country / Region / Cities / Latitude & Longitude.  I would start by concatenating the city and state/region on both sides (your table and look up table) and use that join as a look up value to find the Country. 

I am aware of all of that but the problem is that I don't have all that information. I also know that google maps API includes a function that can return better location string (including country, city, street and post code) if you give it just a city or just a street. It gives you a suggestion it thinks it is the right one and that would be good enough. My question is, does PowerBI include such a function in M language or DAX? If there is no such a function than I will use google maps API, but it would be easier to just correct the data inside queries in PowerBI.

Anonymous
Not applicable

I am personally not aware of any such function. My understanding is that the results are exact from the mapping calls.  It makes a determination on its own where the city belongs based on the information you provide. I could be wrong, but in the experimentation I have done, the more information I am able to plot with the city, the more accurate the results.  I have not used the street address in Power BI so I can't comment on that.

 

If Google is also taking a guess based on the info you are providing it, then you are in the same boat regardless of which API you use.  My suggestion is then to try both and see which algorithm you prefer.  Good luck.

vanessafvg
Super User
Super User

maybe you can scrape a website somewhere with that information?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.