Nested If in M Query

I have the following query in M and wanted to know where my syntax issue is wrong:

Original Source = each if [#“Original Source Drill-Down 1”] = “IMPORT”
then “Events” , else if [#“Original Source Drill-Down 1”] = “Salesforce” then “Salesforce”, else [Original Source v.1])

ysherriff_0-1650568266708.png

Thank you for your help.

Hello @ysherriff,

Thank You for posting your query onto the Forum.

You’ve inserted the symbol of “,” in your M code remove them and write it like this -

Original Source = each if [#“Original Source Drill-Down 1”] = “IMPORT”
then “Events” else if [#“Original Source Drill-Down 1”] = “Salesforce” then “Salesforce” else [Original Source v.1])

Once you remove the comma (",") the code should work.

Hoping you find this useful and meets your requirements that you’ve been looking for. :slightly_smiling_face:

Thanks and Warm Regards,
Harsh

2 Likes

Thank you for the response. It worked and took me awhile to respond. My apologies.