IF (AND) Statement in M

Hi all,

I created the following IF Statement in Dax and was wondering how I can duplicate it in Power Query M.

Marketing Channel =
IF(‘PPD Prospects’[Original Source Drill-Down 1]=“Import” && ‘PPD Prospects’[Create Date]<=DATE(2021,10,31),“Original Data Import”,
If(‘PPD Prospects’[Original Source Drill-Down 1]=“Import” && ‘PPD Prospects’[Create Date]>DATE(2021,11,01),“Event”,
IF(‘PPD Prospects’[Original Source Drill-Down 1]=“Salesforce”,“Salesforce”,‘PPD Prospects’[Original Source])))

Thank you.

Hi @ysherriff

Add a custom column and add the following, should do the trick:

if [#“Original Source Drill-Down 1”] = “Import” then if [Create Date] <= #date(2021,10,31) then “Original Data Import” else “Event” else if [#“Original Source Drill-Down 1”] = “Salesforce” then “Salesforce” else [Original Source]

This will make a create date of 01/11/2021 and drilldown of Import show as Event however, which your current DAX won’t. I wasn’t sure if that was a mistake or not?

Thanks,

3 Likes

Thanks. I don’t want it to show as Event. Any date prior to 11/1/2021 should show up as “Original Data Import”. It shows correctly in DAX. I tested it but I also wanted to know how to do it in M.

Thanks a million

1 Like