Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Excel Power Query - Stop query if record field does not exist

0 I'm running a query which returns a record with a number of fields. If the record contains the field 'CashField', the query continues as normal. However, if the field does NOT exist, is ther...
  • AlienSx's avatar
    2 years ago

    Anonymous your Source does not look like a record... Anyway, _after in_ instead of res write smth like

    if Record.HasFields(your_test_record, "CashField") then name_of_the_last_step else [Ted_Striker_Says = "what a pisser"]. Power Query M is "lazy" so it starts from the end and won't execute subsequent steps if this field is missing.