BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.

Hi,

 

I have a query in which have to provide an option to end user where if he selects R1 then in stack bar chart Measure1 and Measure2 to shown whreas if he selects R2 then it shows Measure3, Measure4 and Measure5 and both the slections are grouped by a category Category1.

 

I tried using parameters but since number of metrics are different unable to get it.

 

 

Reagrds,

Anurag Rai 

1 ACCEPTED SOLUTION

Accepted Solutions
Sam_SAS
SAS Employee

In that scenario you would create three calculated items based on the parameter.

 

IF ( 'Parameter 1'p = 'R1' )
RETURN 'Measure1'n
ELSE 'Measure3'n
IF ( 'Parameter 1'p = 'R1' )
RETURN 'Measure2'n
ELSE 'Measure4'n
IF ( 'Parameter 1'p = 'R2' )
RETURN 'Measure5'n
ELSE .

 

We don't have a way to hide the third measure when R2 is selected, but its values would be blank (missing).

View solution in original post

3 REPLIES 3
Sam_SAS
SAS Employee

Hello,

 

I believe that changing role assignments for a chart based on a parameter is not possible.

The usual workaround to this is to create a calculated item with some IF/ELSE logic like this:

 

IF ( 'Parameter 1'p = 1 )
RETURN 'Measure1'p
ELSE 'Measure2'p

So you could have multiple calculated items based on this type of expression. But when you want to display a different number of measures it makes things harder.

 

You could do something like this:

IF ( 'Parameter 1'p = 'R2' )
RETURN 'Measure5'p
ELSE .

So that when R2 is selected, you show the values of Measure5, but when R1 is selected, all rows are missing. I don't know if that would work for you.

 

Let us know if that helps. Someone else might have another suggestion to offer.

 

Thanks,

Sam

anuragraishines
Quartz | Level 8

Hi Sam_SAS,

 

Thanks for the reply.

In the secomd option you suggested :

IF ( 'Parameter 1'p = 'R2' )
RETURN 'Measure5'p
ELSE .

In this case also I will only able to show one metric only whereas I have to show 3 metrics.

Sorry if I am missing anything overhere.

 

Regards,

Anurag Rai

 

Sam_SAS
SAS Employee

In that scenario you would create three calculated items based on the parameter.

 

IF ( 'Parameter 1'p = 'R1' )
RETURN 'Measure1'n
ELSE 'Measure3'n
IF ( 'Parameter 1'p = 'R1' )
RETURN 'Measure2'n
ELSE 'Measure4'n
IF ( 'Parameter 1'p = 'R2' )
RETURN 'Measure5'n
ELSE .

 

We don't have a way to hide the third measure when R2 is selected, but its values would be blank (missing).

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
  • 3 replies
  • 524 views
  • 0 likes
  • 2 in conversation