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.
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?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |