Hello,
How do I end this expression? It is good up to the last line, which stays blacked out (I have it bolded below). I've tried ending with parentheses and with "else", endif. Does anyone have suggestions?
IIF (contains([ProductCode],"065"), tonumber([Sum_NetUnits])*.184 OR
contains([ProductCode],"167"), tonumber([Sum_NetUnits])*.244 OR
contains([ProductCode],"227"), tonumber([Sum_NetUnits])*.001
Thank you,
Laurie
Solucionado! Ir para Solução.
Hi @Lauriek
Formula would be like
If contains([ProductCode],"065") then tonumber([Sum_NetUnits])*.184
Elseif contains([ProductCode],"167") then tonumber([Sum_NetUnits])*.244
Elseif contains([ProductCode],"227") then tonumber([Sum_NetUnits])*.001
Else Null()
Endif
Hope this helps : )
That worked, thank you so much!!
Happy to help : ) @Lauriek
Cheers and have a nice day!
Here is a resource which might help you with this topic : https://community.alteryx.com/t5/Interactive-Lessons/Writing-Conditional-Statements/ta-p/98910
Just to add to this a little -
The form of IF that you had used initially "IIF" can also work as follows -
IIF(contains([ProductCode],"065"), tonumber([Sum_NetUnits])*.184,
IIF(contains([ProductCode],"167"), tonumber([Sum_NetUnits])*.244,
IIf(contains([ProductCode],"227"), tonumber([Sum_NetUnits])*.001,null())))
It works like an Excel nested if. Although, personally I think it's easier to read the way atcodedog has suggested.
Regards,
Ben
Thank you for your solution also, I will keep both of these in mind for future use.