Power Query Switch Function vs If statement

Need help with the correct syntax.  I need to determine based on 3 columns (Year, Years of Service, Terminate)  if the years of service fall between the following criteria or the Termnate column has a date.

   if(["#YearsofService"]=>2,"2+ Years" else "Less than 2 Years") else Terminate(has a date) is not null.  This will be for an new column displaying the criteria text.

also tried Switch function.

=SWITCH(TRUE()
 [#"#YearsofService"] >=2,"2 + Years" & [#"#YearsofService"] <2, "Less Than 2 Years",
 not isblank([Term Date]), "Termed"
 )
Karen SchaeferBI ANALYSTAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPRetiredCommented:
your if statement seems incorrect. You don't use if statements for a switch.

i.e.
switch ( a = b)
:true
do something here
:false
do something else here
:default
default action

if(["#YearsofService"]=>2,"2+ Years" else "Less than 2 Years") else Terminate(has a date) is not null.

if ((yearsofservice>=2) OR ((2 + years) = ???) or (Terminate != null))

what is the truth table you want to make into a formula?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Karen SchaeferBI ANALYSTAuthor Commented:
Thanks for your input, however, I am confused.

I tried a switch statement and was unsuccessful:

=SWITCH(TRUE()
  [#"#YearsofService"] >=2,"2 + Years" & [#"#YearsofService"] <2, "Less Than 2 Years",
  not isblank([Term Date]), "Termed"
  )

I need to verify if the Termed field (Date) contains a date if so then return the value of "Termed", else the years of service  > = 2 return the value of "2 + Years"  else,"Less Than 2 Years",

So I need to look at the value of 2 different fields and see if it matches any of the above criteria and return the correct value statement.

K
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.