Quantcast
Channel: Service topics
Viewing all articles
Browse latest Browse all 62223

Can't schedule refresh for Power BI report in the service due to web data source used in the pbix

$
0
0

Hi,

 

I have a pbix file where I am using a custom created function in Power Query to get coordinates for addresses.

I do that by passing a parameter which stores an APIKey and a variable for the location address.

 

Everything works fine in Desktop, but when I publish the report I can't schedule a refresh:

mtomova_0-1743671580085.png

 

From what I read online I need to pass the dynamic part of the url in the function as a relative path.

I tried doing that, but I get another error in Desktop.

 

Please see below the original code of the function, which works fine in Desktop:

(location as text) =>

let
Source = Json.Document(Web.Contents(
"https://maps.googleapis.com/maps/api/geocode/json?address=" &
location & "&key=" & APIKey)),
#"Converted to Table" = Table.FromRecords({Source}),
#"Expanded results" = Table.ExpandListColumn(#"Converted to Table", "results"),
#"Expanded results1" = Table.ExpandRecordColumn(#"Expanded results", "results", {"formatted_address", "geometry"}, {"formatted_address", "geometry"}),
#"Expanded geometry" = Table.ExpandRecordColumn(#"Expanded results1", "geometry", {"location"}, {"location"}),
#"Expanded location" = Table.ExpandRecordColumn(#"Expanded geometry", "location", {"lat", "lng"}, {"lat", "lng"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded location",{"status"})
in
#"Removed Columns"

 

 

Below, please see the update code which uses RelativePath and fires up an error:

(location as text) =>

let
Source = Json.Document(Web.Contents(
"https://maps.googleapis.com/maps/api/geocode/json?address=",
[RelativePath = location & "&key="] & APIKey)),

#"Converted to Table" = Table.FromRecords({Source}),
#"Expanded results" = Table.ExpandListColumn(#"Converted to Table", "results"),
#"Expanded results1" = Table.ExpandRecordColumn(#"Expanded results", "results", {"formatted_address", "geometry"}, {"formatted_address", "geometry"}),
#"Expanded geometry" = Table.ExpandRecordColumn(#"Expanded results1", "geometry", {"location"}, {"location"}),
#"Expanded location" = Table.ExpandRecordColumn(#"Expanded geometry", "location", {"lat", "lng"}, {"lat", "lng"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded location",{"status"})
in
#"Removed Columns"

 

The error after the update on the M code:

mtomova_1-1743671881444.png

 

Not sure what am I doing wrong.

 

Thanks,

Maria


Viewing all articles
Browse latest Browse all 62223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>