Forum Discussion
Power query : do action when a function is successfull
- Anonymous3 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 TeamIf 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
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 🙂
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