Forum Discussion
Anonymous
5 years agoNot applicable
Nested If Statement PowerQuery
Hi need help with a nested if statetment. I have a table with a Location_code and Unit. Need the follwoing if statement in power query IF the location code is "130" or "600" then replace all the ...
- 5 years ago
Anonymous
Modified:if ([Location_Code] = 130 or [Location_Code] = 600) and [Units] = "IPO" then [Units] else if ([Location_Code] = 130 or [Location_Code] = 600) then "Mixed" else [Units]
Fowmy
5 years agoSuper User
Anonymous
Do you need a new column? Hope you have two column Location_Code and the Units. If you have numbers in units, why do you want to have text in that as "mixed" ?
Anonymous
5 years agoNot applicable
Yes, it will be a new column and the Unit is text not numbers oringinaly. Example Unit: GRE, ADO, or ADU.
- Fowmy5 years agoSuper User
Anonymous
Click on Custom Column and add the following code:if [Location_Code] = 130 or [Location_Code] = 600 then "Mixed" else [Units]- Anonymous5 years agoNot applicable
OK add complexity. Forgot to include the logic if Unit equals IPO then Unit. So Location codes that are 130 or 600 and the unit is IPO then UNit else if the Location Code is 130 or 600 then Mixed
- Fowmy5 years agoSuper User
Anonymous
Modified:if ([Location_Code] = 130 or [Location_Code] = 600) and [Units] = "IPO" then [Units] else if ([Location_Code] = 130 or [Location_Code] = 600) then "Mixed" else [Units]