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 have a query setup to invoke a custom function that uses the Bing Maps API call to retrieve the distance and drive time to a list of addresses. My data set currently only has 500 rows so the function gets used 500 times everytime I refresh the data. This takes about 15 minutes for the query to run through the 500 rows.
My question, is there anyway to commit the distance and drive time data into the query so that the next time I refresh the data it sees that it already retrieved that data and to ignore it this time around? I really would only want the custom function call to run with newly added rows of data and to ignore all the existing rows.
I was thinking worst case, all the data is saved in an Excel file, so after I ran the funtion the frist time, I could manually commit the API data back into the orginal Excel file and setup a second query that only runs if the data is missing. I would prefer not to have to manually commit the data into the Excel file. Maybe the answer is to somehow automate it to update the Excel file? If that seems to make sense to anyone, any advice on how to commit that data back?
Solved! Go to Solution.
I used the following video to create an R Visual that exports the Excel file and overwrites the orginal. One query is used for the main dashboard. A second query creates the duplicate Excel file that gets exported out after the API call is finished.
Power BI - Write Data to Excel (On Multiple Tabs) - Bing video
library(openxlsx)
dataset2 = dataset[,c("Name","Address","Notes","Website","TravelDistance","TravelDuration","TravelDurationTraffic","Latitude","Longitude")]
tabs = list("Sheet 1" = dataset2)
hs = createStyle(fontSize=11, fontColour="#000000",halign="center",fgFill="#CCCCCC")
if(dataset$Selection[1]=="Write") {
write.xlsx(tabs, file ="C:/Users/User/Data/Data.xlsx", colWidths = "12", headerStyle = hs)
openXL(file = "C:/Users/User/Data/Data.xlsx") }
plot(1,1)
I used the following video to create an R Visual that exports the Excel file and overwrites the orginal. One query is used for the main dashboard. A second query creates the duplicate Excel file that gets exported out after the API call is finished.
Power BI - Write Data to Excel (On Multiple Tabs) - Bing video
library(openxlsx)
dataset2 = dataset[,c("Name","Address","Notes","Website","TravelDistance","TravelDuration","TravelDurationTraffic","Latitude","Longitude")]
tabs = list("Sheet 1" = dataset2)
hs = createStyle(fontSize=11, fontColour="#000000",halign="center",fgFill="#CCCCCC")
if(dataset$Selection[1]=="Write") {
write.xlsx(tabs, file ="C:/Users/User/Data/Data.xlsx", colWidths = "12", headerStyle = hs)
openXL(file = "C:/Users/User/Data/Data.xlsx") }
plot(1,1)
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 |
---|---|
112 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |