Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
3 years ago
Solved

Power query : do action when a function is successfull

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 latitu...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Syndicate_Admin ,

     

    Please try:

    = Table.AddColumn(
        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"}
        ),
        "Error",
        each let
            addressResult = try fxPointLookup(Text.Trim(Text.Replace([Address], "&", " and "))),
            cityResult = try fxPointLookup(Text.Trim(Text.Replace([City], "&", " and "))),
            countryResult = try fxPointLookup(Text.Trim(Text.Replace([COUNTRY], "&", " and ")))
        in
            addressResult[HasError] and cityResult[HasError] and countryResult[HasError]
    )

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum