Skip to content

Working with Dates and Time

Most business analysis is time-based. Revenue trends, seasonal patterns, year-over-year comparisons—all require working with dates effectively. This guide covers the essential techniques for handling date and time data in Querri.

Dates unlock the most valuable business questions:

  • Trends: Is revenue growing or declining?
  • Seasonality: When are our peak periods?
  • Comparisons: How does this quarter compare to last year?
  • Recency: What happened in the last 30 days?

Without proper date handling, you’re stuck with static snapshots instead of dynamic insights.

Querri recognizes most common date formats automatically:

FormatExample
ISO 8601 (preferred)2024-03-15
US format03/15/2024
European format15/03/2024
Text month15-Mar-2024
Full textMarch 15, 2024
With time2024-03-15T14:30:00

Pull out components from dates for grouping and filtering.

"Add a year column from the order_date"
"Extract the month from each date"
"Get the day of week for each transaction"
"Add a quarter column"
PartExample valuesUse for
Year2023, 2024Year-over-year comparisons
QuarterQ1, Q2, Q3, Q4Quarterly reporting
MonthJanuary, 1-12Monthly trends
Week1-52Weekly analysis
Day1-31Daily patterns
Day of WeekMonday-SundayWeekly patterns
Hour0-23Intraday analysis

Create useful groupings:

"Add year and month columns for monthly grouping"
"Extract year, quarter, and month from the date"
"Add a year-month column like '2024-03'"

Focus on the time periods that matter.

"Filter to March 2024"
"Show only Q4 2023 data"
"Keep transactions from 2024"
"Filter to weekdays only"
"Filter to January through March 2024"
"Show data from 2023-01-01 to 2023-12-31"
"Keep orders between Black Friday and New Year"

Filter based on “now” for dynamic reports:

"Filter to the last 30 days"
"Show data from the last 12 months"
"Keep transactions from this quarter"
"Filter to year to date"
"Show orders from before July 2024"
"Filter to customers who joined after 2023"
"Keep transactions from the last week"

Group data by time periods for trend analysis.

"Total revenue by month"
"Weekly order counts"
"Daily active users"
"Quarterly sales"
Time grainBest forData needed
HourlyIntraday patterns, operationsAt least a few days
DailyRecent detailed trendsAt least a month
WeeklyBalanced detail/readabilityAt least 3 months
MonthlyBusiness reportingAt least a year
QuarterlyExecutive reportingAt least 2 years
YearlyLong-term trends3+ years

If your fiscal year differs from calendar year:

"Group by fiscal quarter (starting in April)"
"Add fiscal year column where fiscal year starts in July"

Compare time periods to understand change.

"Compare this month's revenue to last month"
"Show month-over-month change in orders"
"Calculate MoM growth rate"
"Compare 2024 to 2023 by month"
"Year-over-year revenue growth"
"Show this quarter vs same quarter last year"
"Compare this March to last March"
"Show Black Friday sales for the last 3 years"
"Compare Q4 across all years"

Create comparison views:

"Create a table with monthly revenue for 2023 and 2024 side by side"
"Show weekly sales with this week, last week, and same week last year"

Discover when things happen.

"Show average revenue by month to see seasonal patterns"
"Compare quarterly performance over multiple years"
"Which months have the highest sales?"
"Average orders by day of week"
"Compare weekday vs weekend sales"
"Which day has the most customer signups?"
"Show orders by hour of day"
"When do customers most often make purchases?"
"Average response time by hour"
"Show days with unusually high or low sales"
"Find weeks where orders dropped more than 20%"
"Highlight dates that are statistical outliers"

Create new date-based columns.

"Calculate days between order and delivery"
"Add a column for customer tenure in months"
"How many days since last purchase for each customer?"
"Add 30 days to each date"
"Find the first day of each month"
"Calculate the last day of each quarter"
"Calculate age from birth date"
"Days since last activity for each user"
"How old is each open ticket?"

Smooth out noise with moving windows.

"Calculate 7-day moving average of sales"
"Add a 30-day rolling average column"
"Show weekly revenue with 4-week moving average"
"Calculate rolling 12-month revenue"
"Show 90-day cumulative orders"
"Add trailing 30-day total"
  • Smooth volatility: Daily data can be noisy; 7-day averages smooth it out
  • Spot trends: Rolling averages reveal underlying trends
  • Compare fairly: Rolling totals normalize for time period length

Time series often have gaps:

"Fill in missing dates with zero values"
"Are there any gaps in the date sequence?"
"Show which dates are missing from the data"

When dates aren’t recognized properly:

"Convert the date_string column to proper dates"
"Parse dates from the text column"
"Standardize all dates to YYYY-MM-DD format"
"Convert timestamps to Eastern time"
"What timezone are these dates in?"
"Normalize all times to UTC"

Be careful comparing partial periods:

"Exclude the current month (it's not complete yet)"
"Show only full weeks"
"Filter out partial quarters"
Step 1: "Extract year and month from order_date"
Step 2: "Calculate total revenue by year-month"
Step 3: "Create a line chart of monthly revenue"
Step 1: "Add year and month columns"
Step 2: "Pivot revenue by month (rows) and year (columns)"
Step 3: "Calculate YoY percentage change"
Step 1: "Extract signup month for each customer"
Step 2: "Calculate months since signup for each transaction"
Step 3: "Group by signup cohort and tenure month"
Step 1: "Calculate average revenue by month across all years"
Step 2: "Create a bar chart showing monthly averages"
Step 3: "Identify peak and low months"
  1. Verify date ranges first — Know what time periods your data covers
  2. Check for gaps — Missing dates can skew analysis
  3. Be explicit about time zones — Especially for data from multiple sources
  4. Use complete periods — Don’t compare full months to partial months
  5. Consider business context — Fiscal years, holidays, seasonal factors
  6. Document your time grain — Make clear whether data is daily, weekly, etc.

With date skills, you’re ready for advanced time-based analysis: