jeudi 19 juillet 2018

Can I divide a column with days of absence into categories (short, medium, long) in BigQuery SQL?

I currently working on a project where I am analyzing employees. In this dataset I also have a table with absence, counted in number of days. I would like to divide this column into three categories; short absence (<8 days), medium absence (8-43 days), long absence (43 - 366 days) and extra long absence (>366 days). However when I try to do this with the IF statement in Bigquery I get the following error:

Error: No matching signature for function IF for argument types: BOOL. Supported signature: IF(BOOL, ANY, ANY) at [12:3]

Thus, according to this error I cannot use the IF function if the column takes on more than 2 values.

Does anyone know a way around this or a code with which you can make such categories?

Many thanks!

Aucun commentaire:

Enregistrer un commentaire