BookmarkSubscribeRSS Feed
acrosb
Calcite | Level 5

Hi,

 

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?

 

1 REPLY 1
JBS_SAS
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

       END

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!

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 676 views
  • 1 like
  • 2 in conversation