# Date Diff - Tenure

⚪️

Hello,

I am looking to build a tenure-based view for a list of employees. I have a hire date field and I want to create a filter to show some categorized options.

Can someone validate if this is possible and any ideas will appreciated

Employees that have 3 weeks of experience ( Something like if datediff today()- HireDate) >21 then 'Employees with three weeks experience' and so on?

• Portland, Oregon 🥷

@gospel That is correct. You could also do the opposite if that is easier for you if you reverse your signs like this:

```CASE WHEN DATEDIFF(CURRENT_DATE(), `dt`) <= 7 THEN '1 week or less'
WHEN DATEDIFF(CURRENT_DATE(), `dt`) <= 14 THEN '2 Weeks'
WHEN DATEDIFF(CURRENT_DATE(), `dt`) <= 21 THEN '3 Weeks'
ELSE 'More than 3 weeks'
END
```

You can create as many WHEN statements as you want and then use the ELSE statement to do anything beyond that.

**Make sure to any users posts that helped you.

• Portland, Oregon 🥷

Yes, you could do this:

```CASE WHEN DATEDIFF(CURRENT_DATE(), `dt`) >= 21 THEN '3 Weeks or more'
WHEN DATEDIFF(CURRENT_DATE(), `dt`) >= 14 THEN '2 Weeks or more'
....
END
```

You will want to work chronologically, though in order to make it work. In this case going from greatest to smallest since the case statements stop evaluating and exit out once they find a match.

**Make sure to any users posts that helped you.
• ⚪️

Thank you @MarkSnodgrass , So start with the highest bucket like More than three months, then slide down to the cases with weeks.

• Indiana 🥷

Alternatively you could utilize some math functions to simplify your beast mode to calculate just the tenure in weeks - this would allow easier filtering using a single numeric value:

```FLOOR(DATEDIFF(CURRENT_DATE(), `dt`) / 7)
```