Forum Discussion
gauravnarchal
6 years agoPost Prodigy
PowerQuery if with multiple conditions AND OR
Hello Guys,
I need your help!
How can I replicate this on PowerQuery ??
if [Code]= "QW" and [ClassOfService] = "W,E,T" then "Sunny"
else [Code]= "ER" and [ClassOfService] = "B"A"L" then "Rainy"
else {Segments.ClassOfService} = ["C","D","I","Z","J"] then "Heritage"
else if {Segments.ClassOfService} in ["S","Y","K","B","E","H","L","U","N","O","Q","R","T","M","X","G","V","W"] then "Classic"
else if {Segments.ClassOfService} in ["F","A","P"] then "Budget"
Thanks
Gaurav
Buckle up, this will be a wild ride.
Power Query doesn't understand lists (as far as I know). You are stuck with "or".
if [Code]= "QW" and ([ClassOfService] = "W" or [ClassOfService]="E" or [ClassOfService]="T") then "Sunny" else if [Code]= "ER" and ([ClassOfService] = "B" or [ClassOfService]="A" or [ClassOfService]="L") then "Rainy" else if ([ClassOfService] = "C" or ... or [ClassOfService] = "J"]) then "Heritage" else if ([ClassOfService] = "S" or ... or [ClassOfService] = "W"]) then "Classic" else if ([ClassOfService] = "F" or ... or [ClassOfService] = "P"]) then "Budget" else "something else"
2 Replies
- lbendlinSuper User
Buckle up, this will be a wild ride.
Power Query doesn't understand lists (as far as I know). You are stuck with "or".
if [Code]= "QW" and ([ClassOfService] = "W" or [ClassOfService]="E" or [ClassOfService]="T") then "Sunny" else if [Code]= "ER" and ([ClassOfService] = "B" or [ClassOfService]="A" or [ClassOfService]="L") then "Rainy" else if ([ClassOfService] = "C" or ... or [ClassOfService] = "J"]) then "Heritage" else if ([ClassOfService] = "S" or ... or [ClassOfService] = "W"]) then "Classic" else if ([ClassOfService] = "F" or ... or [ClassOfService] = "P"]) then "Budget" else "something else"- gauravnarchalPost Prodigy