Forum Discussion
Prevent Bing map API function from running/refreshing when the query is edited.
- 5 years ago
Anonymous you cannot avoid the full refresh, as soon as you refresh, it is going to refresh and make that function call for each row.
In the step where you invoke your custom function, you can wrap it in an if..then..else, where it checks if the Distance column = null. If so, run the function and, if not, return the Distance column value.
Instead of "... each fnDistince([City1], [City2]) ...", try
"... each if [Distance] = null then fnDistince([City1], [City2]) else [Distance] ..."
Regards,
Pat
- Anonymous5 years agoNot applicable
Thank you, that looks like it will do the trick, I will try it and post the result and accept your solution.
- Anonymous5 years agoNot applicable
Here are my current steps, I tried inserting the condition with no luck. The error indicated that Distance could not be converted?
#"Added Custom" = Table.AddColumn(#"Added Conditional Column", "Distance", each fxMilesDuration([Address],[Work Location])),
#"Expanded Distance" = Table.ExpandTableColumn(#"Added Custom", "Distance", {"TravelDistance", "TravelDuration"}, {"Distance.TravelDistance", "Distance.TravelDuration"})
in
#"Expanded Distance"