I want to add I conditional column which:
As soon as i add the third step it seems that all rules break up. Below is my code:
= Table.AddColumn(#"Filtered Rows", "Category", each if [#"Code"] = "1" or [#"Code"] = "2" then "Step 1" else if [#"Code"] = "3" then "Step 2" else if [#"Code"] = "4" or [#"Code"] = "5" and [Quantity] >0 then "Step 3_A" else if [#"Code"] = "4" or [#"Code"] = "5" and [Quantity] <0 then "Step 3_B"
Any help?
You need parentheses.
= Table.AddColumn(#"Changed Type", "Custom", each if [#"Code"] = "1" or [#"Code"] = "2" then "Step 1" else if [#"Code"] = "3" then "Step 2" else if ([#"Code"] = "4" and [Quantity] >0) or ([#"Code"] = "5" and [Quantity] >0) then "Step 3_A" else if ([#"Code"] = "4" and [Quantity] <0 ) or ([#"Code"] = "5" and [Quantity] <0) then "Step 3_B" else null)