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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I created a geocoding function through R script using Google API. The problem is when I geocoded the data in Power BI, the process stopped when encountered a bad address. How should I modify the DAX to solve this problem? I want Power BI to skip the error and continue to the next geocoding. Below is the geocoding function I created.
let
Source = (Parameter as text) => let
Source = R.Execute("library(httr)#(lf)google_api <- ""https://maps.googleapis.com/maps/api/geocode/json""#(lf)geocode <- function(address, verbose=FALSE) {#(lf)r <- GET(google_api, query=list(address=address))#(lf)stop_for_status(r)#(lf)result <- content(r)#(lf)first <- result$results[[1]]#(lf)df <- as.data.frame(list(lat=first$geometry$location$lat, lon=first$geometry$location$lng))#(lf)return(df)#(lf)}#(lf)result <- geocode("""&Parameter&""")"),
result1 = Source{[Name="result"]}[Value]
in
result1
in
Source
@monicamarrick wrote:
I created a geocoding function through R script using Google API. The problem is when I geocoded the data in Power BI, the process stopped when encountered a bad address. How should I modify the DAX to solve this problem? I want Power BI to skip the error and continue to the next geocoding. Below is the geocoding function I created.
let
Source = (Parameter as text) => let
Source = R.Execute("library(httr)#(lf)google_api <- ""https://maps.googleapis.com/maps/api/geocode/json""#(lf)geocode <- function(address, verbose=FALSE) {#(lf)r <- GET(google_api, query=list(address=address))#(lf)stop_for_status(r)#(lf)result <- content(r)#(lf)first <- result$results[[1]]#(lf)df <- as.data.frame(list(lat=first$geometry$location$lat, lon=first$geometry$location$lng))#(lf)return(df)#(lf)}#(lf)result <- geocode("""&Parameter&""")"),
result1 = Source{[Name="result"]}[Value]
in
result1
in
Source
Error-handling in Power Query may help, can you try and post the result?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 63 | |
| 55 | |
| 42 | |
| 41 | |
| 23 |
| User | Count |
|---|---|
| 167 | |
| 136 | |
| 120 | |
| 79 | |
| 54 |