Avatar of Karen Schaefer
Karen Schaefer
Flag for United States of America

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"
 )
Microsoft ExcelMicrosoft OfficeMicrosoft ApplicationsVisual Basic.NET

Avatar of undefined
Last Comment
Karen Schaefer

8/22/2022 - Mon