I would like to count the number of weekends between two timestamps. My data sits in Teradata. I can't use a raw time difference because starting points will vary.
Asked
Active
Viewed 518 times
0
-
1You aren't giving us much to work on. Sample data would certainly help. But take a look at the built in calendar view - `sys_calendar.calendar`. It's got a day of the week column that you can use to identify your weekends. – Andrew Jul 18 '18 at 18:25
1 Answers
0
The week difference should be equal to the count of weekends between two Timestamos, so just try:
ABS(td_week_of_calendar(TS_2) - td_week_of_calendar(TS_1))

hhoeck
- 361
- 2
- 3