Karen Schaefer
asked on
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"
)
if(["#YearsofService"]=>2,
also tried Switch function.
=SWITCH(TRUE()
[#"#YearsofService"] >=2,"2 + Years" & [#"#YearsofService"] <2, "Less Than 2 Years",
not isblank([Term Date]), "Termed"
)
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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