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

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 Super FREQ

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 Super FREQ

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
Obsidian | Level 7

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 Super FREQ

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

Innovate_SAS_Blue.png

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