I’ve broken this topic down into a four part series to make it easier to consume and to save you from copious amounts of scrolling. The accompanying video tutorial is already available and the below examples are linked to their corresponding timestamps in the video.
The control objects and examples I will cover in this series include:
In this example, I will prompt the user to select two date values formatted using Month Year (MMMYYYY). The list table will use these values as low and high boundaries for a between inclusive filter condition which will return consecutive weeks in the object. To show case a different filter, the bar chart on the other hand, will use these values to compare the two selected values rolled up to the month level.
Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.
You may be wondering, why use the drop-down list instead of the slider (range)? Here are a few reasons:
The technique used in this example will follow these steps:
Use the page’s overflow menu to Expand page controls so that it is easy to see where you are dragging the Drop-down list control objects. Do not place the control object in the Page prompt area, but directly under it in the report canvas.
Remember, we need two! I placed mine side-by-side.
Next, we need to assign the Roles and use the object’s Title Option to label our control objects to assist our report users.
Here is the first control object:
And here is the second control object:
Now we will need to create two parameters to store the selected values from the Drop-down list control objects so that we can use these values in our filter expressions.
From the Data pane, use the New data item menu and select Parameter. Enter the new parameter information for the date data item. Be sure to select the correct Type and Format.
Repeat for the second parameter. Be sure to give the parameters meaningful names.
Next, we need to assign these parameters to their corresponding Drop-down list control objects’ Roles so that it stores the value selected.
Now we have our date boundaries which are being selected via the Drop-down list control objects and stored in our two parameters. Next we need to define and apply our Filters to our report objects.
First, we will define the filter for the List Table object. Recall that we want this to be a between inclusive for our two boundary values. Select the List Table object and then use the Filter pane and from the New filter menu select Advanced filter.
Next, build the filter expression for the Month Year date data item using the between inclusive condition and our two parameter items as the lower and upper boundaries.
Now we can build our filter for the Bar Chart object. This is where we want to compare the two selected months and therefore, will use a different kind of filter from the between inclusive, we will use an or condition.
With the Bar Chart object selected, use the Filter pane and from the New filter menu, select Advanced filter.
Next, build the filter expression for the Month Year date data item using an OR condition for both parameter values.
Success! Now test it out. You can see the list table object returns the between inclusive weeks for the date boundaries and the bar chart compares the two selected date values.
Here’s a summary of the technique for Example 3: Drop-down list:
How to prompt for a date range in a SAS Visual Analytics report Series:
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.