If you are running a tracking study, you may want to have tables that focus on results only from the latest month or quarter.
This article describes how to use Displayr's built-in filter functionality to automatically work out which people are in the latest period. This method also allows for the updating of data without the need to remake the variable.
In this example, we will create a variable set that includes a variable for the last 4 weeks and one for the previous 4 weeks.
Requirements
- A Date/Time variable in your data set OR...
- A text variable of a date in one of the standard formats, e.g., month/day/year or day/month/year, which can be converted to a Date/Time variable by selecting it in the Data Sources tree and changing Data > Properties > Structure to Date/Time.
Method
Last 4 weeks filter
- In the Data Sources pane, hover over a variable where you want the new filter variable to go and click + > Filter > New.
- Select your date variable. In this example, we will use a date variable called Interview Date.
- Set the condition to is within last period, the value to 1, and then in the drop-down select Four Week.
- Update Specify conditions to generate a default name... at the very top to Last 4 Weeks.
- Press Create filter.
Previous 4 weeks filter
- In the Data Sources pane, hover over a variable where you want the new filter variable to go and click + > Filter > New.
- Select your date variable.
- Set the condition to is within last period, the value to 2, and then in the drop-down select Four Week.
- Press Add Condition.
- Select your date variable.
- Change the condition to 1 Four Week.
- Now change the condition to is before last period.
- Update Specify conditions to generate a default name... at the very top to Previous 4 Weeks.
- Press Create filter.
Combine filters
- Select both variables in the Data Sources tree.
- Right-click > Combine.
- In the object inspector, update the Label field.
- If there is a warning in orange, click Fix > OK.
Next
How to Dynamically Filter Data to the Latest Waves
How to Create a Complicated Filter
How to Calculate the Difference Between Two Dates