BookmarkSubscribeRSS Feed
Calcite | Level 5



I am trying to make a line chart in which the user can select which and how many lines are graphed. For simplicity, let's say I have two lines - 1. the number of pageviews to website A each month and 2. the number of pageviews to website B each month. The X axis is time (months) and the y axis is number pageviews. I want users fo the report to be able to select just the information for website A, just website B, or both.


My source data looks something like this:


Month    Website A    Website B

Jan               5                  20

Feb               2                  25

Mar               3                  30


I tried just adding a drop-down box to the line chart, but it seems I have to add a single category variable (ex. month), so that wouldn't work since I would want the two numeric variables added (i.e. Website A and Website B).


I also tried adding filters and an interaction. I tried making Website A and Website B filters, but it seems I can't add interactions to line charts. But I also tried this same concept but with a bar chart, and I couldn't seem to create it that way either.


I'm using SAS VA Cloud (a free trial).


Any ideas? What am I missing? Does it just have to do with how my data is structured?


SAS Employee

Three steps (haven't checked syntax):

1.  Create a Paramater called Selected Pageviews

2.  Create a new calculated measure called Pageviews with a IF THEN ELSE statement that checks the value of the paramater.  For example:

       IF 'Selected Pageviews'p = 'Website A' THEN 'Website A'n

                 ELSE WHEN 'Selected_Pageviews'p = 'Website B' THEN 'Website B'n

                 ELSE RETURN 0


3.  This is the tricky part.  You need to create a calculated category that will contain 2 values (Website A and Website B) so that a dropdown or button bar selector can be populated for the paramater selection.  I try to find a category in the data that I know will not every be filtered out completly and assign the values to a group.  Maybe use a Custom Category instead of a calculated category will work best.  Once that's created then assign the paramater to the control (dropdown or button bar) and use the new Pageview measure on the line chart.  Don't use the Website A/B measures anymore on the visualizations.   When you change the button bar or dropdown the line chart should change.


Hope this helps!




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. 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1 like
  • 2 in conversation