I am getting "Invalid Type in Operator ==". My code that I am trying to run is below.
Switch([PARENT_HIERARCHY],'Other',
Contains('SB009',[PARENT_HIERARCHY]),'Medicare',
contains('SB120',[PARENT_HIERARCHY]),'Medicaid',
contains('HI085',[PARENT_HIERARCHY]),'Other Government Services',
contains('HI079',[PARENT_HIERARCHY]),'Other Government Services',
contains('HW009',[PARENT_HIERARCHY]),'Other Government Services',
contains('H1150',[PARENT_HIERARCHY]),'Commercial Business',
contains('CR600',[PARENT_HIERARCHY]),'Local Market Business',
contains('CC000',[PARENT_HIERARCHY]),'Marketing & Networking',
contains('HA060',[PARENT_HIERARCHY]),'Marketing & Networking',
contains('SO000',[PARENT_HIERARCHY]),'Service Ops',
contains('SE800',[PARENT_HIERARCHY]),'Strategy, Consumer Experience & Other',
contains('IN001',[PARENT_HIERARCHY]),'Strategy, Consumer Experience & Other',
contains('SZ000',[PARENT_HIERARCHY]),"Int'l Business",
contains('H1130',[PARENT_HIERARCHY]),'CHS',
contains('CC200',[PARENT_HIERARCHY]),'CHS',
contains('H9999',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',
contains('H1140',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',
contains('H1170',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',
contains('H1180',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',
contains('SS000',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',
contains('HW084',[PARENT_HIERARCHY]),'Enterprise Areas, Investment Mgmt & Other',
contains('IT000',[PARENT_HIERARCHY]),'IT',
contains('BC001',[PARENT_HIERARCHY]),'Broker Commissions',
contains('TX001',[PARENT_HIERARCHY]),'Tax')
Thank you!
)
Solved! Go to Solution.
Thank you for replying @MarqueeCrew.
I am using a formula tool to add a new data field based on [PARENT_HIERARCHY]. I apologized, I am new to Alteryx and am not quite sure how I can use find and replace to create a new field based on the content of [PARENT_HIERARCHY].
Hi @trangt ,
Take a look at the attached example. I'm showing exactly what @MarqueeCrew told you to do.
The idea is to use a find replace tool instead of that huge switch function.
Let me know if this works for you.
Best,
Fernando Vizcaino
works perfectly, thank you!