You can use Date/Time variables in crosstabs and Banners with other variables to see trends over time, perform significance testing against the previous period, specify columns to be compared in a table, and perform date calculations. Variables with a Structure of Date/Time in Displayr are dates based on a timeline (versus being general category labels). This is so you can do calculations on time between dates, show space for missing dates, and ensure your dates are always in order.
Displayr makes it easy to configure your dates to show different periods of time to compare trends and do testing. In the variable's Properties, there is a special Date/Time Aggregation button that opens a menu where you can configure your date via point-and-click, rather than writing code. This menu allows you to specify what interval of period you want to use (Aggregation), the period anchor, and the range of dates displayed. Below is a list of examples of how to configure your date based on various needs:
- Change the type of dates shown in tables (Aggregation)
- Control the start of your Date/Time aggregation (Period anchor)
- Change the start/end of your dates (Date Range)
- Change the dates shown to the latest period(s) (Duration)
- Customize the labels and categories of your Date/Time variable
Requirements
- A variable with a Structure of Date/Time. If you have a date variable that isn't structured as a Date/Time variable, there are various ways to convert it; see How to Create Date Variables in Displayr.
Change the type of dates shown in tables (Aggregation)
Date variables are a list of dates that represent a point in time, i.e., 1/2/2024 or 2/3/2024 00:00:00. When you analyze Date/Time data, you will want to combine the dates into larger aggregations such as daily, weekly, monthly, etc. When you click the Date/Time Aggregation button in Properties > Attributes, you can set the following aggregations in Displayr:
For example, a Date/Time variable set up with Date/Time > Aggregation > 1 Month will show as follows in a table:
Changing that to Aggregation > 1 Quarter will show typical quarters in the table instead:
Control the start of your Date/Time aggregation (Period anchor)
You can set the first day of each period using the Period anchor setting. Pick any date, and all periods align to it. This is useful when you don't want weeks to start on Monday or months to start on the 1st, for example. Fiscal quarters can align to whatever calendar you report against. In the image below, you can see that the Aggregation is set to Year, but I've set the Period anchor to July 1 to reflect the fiscal year.
In the Preview section, you will see the selected date range, the number of aggregated periods, and the anchor date to ensure that the dates are aligned with what you expect.
Period defaults
The system will calculate sensible defaults:
- All Data / Duration: Finds the next natural period boundary after the latest date in the data (e.g., the 1st of the month for monthly), then aligns backward to capture the earliest date.
- Date Range: Aligns periods to the user's Maximum (To) date, then works backward to capture the Minimum (From) date.
If a user changes their period unit (e.g., from weeks to months) without ever editing the period anchor, the default recalculates automatically.
The default may point to a date before the data range in the Preview section.
Other period anchor notes
- The Period anchor setting is only available on the following Aggregation periods:
- Weekly
- Biweekly
- 4 Weekly
- Monthly
- Quarterly
- Yearly
- The 31st will round up to the 1st in months without 31 days.
- Table category labels show date ranges (not "Month, Year") when the period anchor isn't set to the 1st .
- You can use How to Hide Empty Rows and Columns in a Table or Visualization to hide empty dates in the future.
Change the start/end of your dates (Date Range)
A Date/Time variable will automatically show all of the data in the data set. You can modify this to only show data for a specific date range by changing Date/Time Aggregation > Period type > Date Range and using the From and To fields. Below, I've done this using April 2024 as the earliest date to report on:
which updates my table results to:
Change the dates shown to the latest period(s) (Duration)
Many times, you may want to have multiple versions of your date variable in your file to show tables/analyses for different time frames. With trackers, it's typical to show tables with historical data as well as tables focusing on the change over the last few periods. To create a variable for the last few periods, you can use Date/Time Aggregation > Duration. For example, below, I want to show the monthly dates in the latest quarter of data:
which shows:
You could also set Duration > 3 Months if you wanted to show the most recent 3 months, regardless of the quarter they're in. If you're working with dates with non-typical start/end times, you should instead create a filter to find the latest periods in your data. See How to Dynamically Filter Data to the Latest Waves.
Note, when you apply a filter that removes a range of dates from this variable, then the dates shown in your table will change accordingly. For example, if your date question contains dates from January to December, and you configure it to show the last 6 months, then you will see July, August, September, October, November, and December. If you filter that table to dates before 1 October, then you will see April, May, June, July, August, and September.
Customize the labels and categories of your Date/Time variable
Once your Date/Time variable is configured, you can customize how its time periods appear in tables, such as renaming the labels, setting periods to missing data, hiding, reordering, creating NETs, and merging - the same way you would for Nominal and Ordinal variables. This is particularly useful for tracking studies where you want to clean up or reorganize how periods are displayed.
- Select your Date/Time variable set in the Data sources menu.
- OPTIONAL: In Documents created prior to May 2026, go to Properties
and click Upgrade to enable category customization.
- Click Values & Labels to open the Values Attributes menu. From here you can:
- Rename a time period label (e.g., change the label from January 2024 to Jan'24).
- Set Missing Values to Exclude from analyses or Hide but include in NET calculations.
Alternatively, you can also change labels and set time periods to missing by first creating a table, then right-clicking the period and selecting Rename, Delete (sets the period to missing), or Hide (sets to Hide but includes in NET calculations).
On tables built from the upgraded Date/Time variable, you can also access Create NET, Combine, Rename, and other operations directly, in the same way as for Nominal and Ordinal variables.
- Drag the Date/Time variable set into the Report tree or onto a Page to create a table:
- From here you can:
- Reorder the time periods by dragging and dropping them into the desired place.
- Create NETs by selecting the time periods, right-click > Create NET.
- Combine periods by selecting them, right-click > Combine.
- Rename labels (right-click > Rename).
In the example below, I created NETs for Q1 2024 and Q2 2024, and combined all other periods into H2 2024:
Notes:
- Customizations are tied to specific dates, not positions in the list, so adding new periods when you refresh your data won't reset labels you've already set.
- If you change the aggregation type (e.g., from Monthly to Quarterly), customizations will reset because the underlying period values change entirely.
- Time series charts do not reflect customizations to the Date/Time variable. Use a standard column, bar, or line chart if you need the customized periods to display correctly.
- When a time period is hidden or merged, column comparisons and "Compare to previous period" tests will test against the time period(s) shown on the table.
Next
How to Conduct Significance Tests by Comparing to Previous Time Periods
How to Abbreviate Month Labels in Tables and Visualizations
How to Work with Date Ranges Using R
Watch our Understanding Variable Sets video
UPCOMING WEBINAR: Run Research Your Way With AI Skills