I have recently set up a Banners for a long term tracking survey we are running, which has the date in two different formats (Weekly & Monthly). We only really want to see the most recent weeks data & then recent months and their 2020 counterparts. I have tried to hide certain dates however I don’t seem to be able to do so. Is there a work around for this?
Variable in Date/Time format
- Pull the date variable up in a table
- Right-click the rows and select Values.
- In the date aggregation window that pops up, set the Period Type drop-down to Duration, then set the duration to the range you want.
Now the data will be aggregated into one-week periods and only the most recent 6 weeks in the data will be shown. Like this:
When you've made these changes, edit your banner and re-add these variables to the banner. The ones in the banners won't update automatically with any aggregation changes you made.
The big challenge here is to create a variable that pulls in the 2021 months and their corresponding 2020 months. Doing that will actually be a little bit harder since you can't have irregular periods like that in a date variable. But, we can do this with an R variable. It won't automatically pull in the most recent months and the corresponding months from a year ago, but you can hide the months you don't need.
To do this do the following:
- Go to the Variables and Questions tab.
- Right-click and select Insert Variable(s) > R Variable.
- In the window that pops up, paste in the code below. (Substitute your monthly Start Date variable for StartDate_2). This will automatically pull in the aggregated categories.
- Click the blue Play button to calculate the variable.
- At the bottom give this question a name and click Add R Variable.
Now you'll have a newPick Onevariable that you can use in place of your monthly date variable and can hide months as needed:
You can use this new variable in place of the month variable in the banner going forward.