HR
How do I use rolling date windows in employee analytics workflows?
Run scheduled employee analytics with compact relative date filters so each run picks up the right cohort without hard-coded dates.
- workflows
- analytics
- hris
When a workflow runs on a schedule (for example weekly), you often need employees who match a rolling date window—such as “started between one month and one month plus seven days ago.” Hard-coding calendar dates in the agent prompt goes stale; asking the AI to calculate dates each run can be inconsistent.
Harriet supports compact relative date expressions in employee analytics filters. The server resolves them on each run.
Syntax
- Start with an anchor:
$today,$yesterday,$last_week,$last_month,$last_year,$next_week,$next_month, and similar. - Add zero or more offsets chained after the anchor:
+or-, a whole number, then a unit:d— daysw— weeksm— months (calendar months)y— years
Examples:
| Expression | Meaning (resolved at run time) |
|---|---|
$today-4w |
Four weeks before today |
$today-1m |
One calendar month before today |
$today-1m-7d |
One month before today, then seven more days back |
$last_month |
One calendar month before today (same anchor as $today-1m) |
Weekly cohort example
To target employees whose start date fell in the seven-day window ending one month ago, instruct the configurable agent to use two filters:
start_dategreater than or equal to$today-1m-7dstart_dateless than$today-1m
Use a lower bound inclusive (gte) and upper bound exclusive (lt) so consecutive weekly runs do not pick up the same people twice, as long as the schedule and offsets align (for example a weekly run with a seven-day window).
Set employed_as_of_date to null when you need to include future starters or filter purely on start_date; leave it at the default today when you only want people employed as of the run date.
Workflow setup
- Create a workflow with a scheduled trigger (see How do I run a workflow on a recurring schedule?).
- Add a configurable agent step with the Employee analytics skill enabled.
- In the agent instructions, describe the cohort in plain language and include the exact filter syntax above when reproducibility matters.
Sample instruction snippet:
Find employees whose start_date is on or after $today-1m-7d and before $today-1m.
Use get_table_data with those filters on start_date, employed_as_of_date null,
fields email and start_date. Summarize the count with summarize_table_data.
Guardrails
- Pilot on a small date range before emailing or ticketing a large cohort.
- Runs very close to midnight may resolve
$todayon a different calendar day than runs earlier the same evening—align schedule timing with your business day. - You still need HRIS sync, analytics permission, and export/personal data access where applicable.
Related help
- What employee analytics questions can Harriet answer? (IT persona; includes syntax overview)
- How does the AI agent step work in a workflow?
Use Harriet in your organisation for searchable help, AI assistance, and your company knowledge base.
Log in to Harriet