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
hatahetahmad
Helper I
Helper I

Google Maps Distance Function Help

I used this function to get duration and distance between two GEO code from "Curbal Youtube Channel"

I thanks Ruth for this amazing function

 

this is it after littel editing:

 

(Origins as text, Destinations as text)=>
let
Source = Json.Document(Web.Contents("https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins="&Origins&"&destinations="&Destinations&"&mode=driving&key="&GMAPIKey)),
rows = Source[rows],
#"Converted to Table" = Table.FromList(rows, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"elements"}, {"elements"}),
#"Expanded elements" = Table.ExpandListColumn(#"Expanded Column1", "elements"),
#"Expanded elements1" = Table.ExpandRecordColumn(#"Expanded elements", "elements", {"distance", "duration"}, {"distance", "duration"}),
#"Expanded distance" = Table.ExpandRecordColumn(#"Expanded elements1", "distance", {"text"}, {"text"}),
#"Expanded duration" = Table.ExpandRecordColumn(#"Expanded distance", "duration", {"text"}, {"text.1"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded duration",{{"text", "Distance"}, {"text.1", "Duration"}})
in
#"Renamed Columns"

 

after scrolling the first 1000 rows I got an error (the Column1 of the table wasn't Found)

 

I know that Google Maps Limit is 25K request per day and I Only used 2,7K a lot less than the free plan offer so I think it can't be the problem

 

I have another question:

When I Invoke the function It makes 13000 request beacuse i have 13K rows, Google maps Get 1000 request beacuse query limit and after I apply it to Power BI Desktop it'll make ?

1000 for the query + 13000 my rows = 14000 request

 

or the first 1000 already been stored then start getting data for th other rows

1000 + 12000 my rows = 13000 total

 

which one is correct so i can calculate and limit my data in future.

 

thank you.

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @hatahetahmad,

After research, you can use a tool like Fiddler to trace your HTTP traffic and see what the detailed message is. And I am not specific about Power Query statement, and I am not sure which one is correct, I personally suggest you post the case to right forum: Power Query forum to get dedicated support. Hope the following threads or article are useful.

Waiting Between Web Service Requests In Power Query
Google Places API and Power Query Function

Engine/IO/Web/Request/GetResponse and Rest API rate limits

Best Regards,
Angelia

View solution in original post

3 REPLIES 3
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @hatahetahmad,

After research, you can use a tool like Fiddler to trace your HTTP traffic and see what the detailed message is. And I am not specific about Power Query statement, and I am not sure which one is correct, I personally suggest you post the case to right forum: Power Query forum to get dedicated support. Hope the following threads or article are useful.

Waiting Between Web Service Requests In Power Query
Google Places API and Power Query Function

Engine/IO/Web/Request/GetResponse and Rest API rate limits

Best Regards,
Angelia

Thank You @v-huizhn-msft

I'll try to find the error using this tools

many thanks

Hi @hatahetahmad,

You're welcome, it's my pleasure to help you. Please mark the helpful reply as answer, so more people will benefit from here.

Best Regards,
Angelia

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