Skip to main content
Community site session details

Community site session details

Session Id : ccc2MxTfRlzcSG9sRPMzlW
Power Apps - Power Query
Answered

Power query : do action when a function is successfull

Like (0) ShareShare
ReportReport
Posted on 9 Aug 2023 09:51:48 by 4

Hi everybody,

 

I'm new in Power BI and I have to use Power query to check if a custom function returns successfully or not.

 

I have some addresses, and I call a Bing maps function to get latitude and longitude coordinates. Sometimes this function fail because address has wrong format. 
I would like to know which address is ok and which is wron, with error or success in a column to indicate the result of the search.

 

Here is the formula to add latitude and longitude columns (it works) : 
= Table.ExpandTableColumn(Table.AddColumn(#"Colonne fusionnée insérée", "LatitudeLongitude", each try fxPointLookup(Text.Trim(Text.Replace([Address], "&", " and "))) otherwise
try fxPointLookup(Text.Trim(Text.Replace([City], "&", " and "))) otherwise fxPointLookup(Text.Trim(Text.Replace([COUNTRY], "&", " and "))) ), "LatitudeLongitude", {"Latitude", "Longitude"}, {"Latitude", "Longitude"})

 

So, now, I would like to add a new column, called "Error", to display "True" if the fxPointLookup call (fxPointLookup(Text.Trim(Text.Replace([Address], "&", " and ")))) failed and "False" if not.

Could you help me to do this please ? 
I don't know how to get the "success" case, or a default case 😢

  • ClarisPO Profile Picture
    4 on 11 Aug 2023 at 12:59:56
    Re: Power query : do action when a function is successfull

    Thanks, It works perfectly 🙂

  • ClarisPO Profile Picture
    4 on 10 Aug 2023 at 07:00:10
    Re: Power query : do action when a function is successfull

    Hi,

    Here is a PowerBI file with sample.

     

    You have to set a Bing Maps API Dev Key in fxPointLookup function (key="YourAPIKey").

     

    In ADDRESS table, column ERROR is a sample of the result I want to obtain dynamically, with the success or fail of calling to fxPointLookup. If fxPointLookup returns some coordinates, I want FALSE. If not (Error of function), I want TRUE.

     

    Thanks for your help 🙂 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Featured topics