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
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).
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
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
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).
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.