Hi,
I am trying to create a button bar which will be used to filter a chart. There are two measures that I would like to user to toggle between (Measure 1 and Measure 2), which I have assigned to a parameter, "Parameter".
I am now trying to create the calculated item, which, if Parameter = Measure 1 will give Aggregated 1, and if Parameter = Measure 2 will give Aggregated 2, as per the below:
IF ('Parameter'p = 'Measure 1')
RETURN 'Aggregated 1'n
ELSE (
RETURN 'Aggregated 2'n)
However, I'm getting an error relating to 'Measure 1', reading "An element cannot be aggregated"
And another error related to the if statement, reading "Operand can only be aggregated, but this operator does not support aggregation.
Any ideas what I'm doing wrong? Can I not use aggregated measures in an if statement like this?
I have faced a similar issue in SAS VA 7.3 before. Instead of creating a button to filter the chart, how about creating two different charts and placing them into a stack container? The user can select the chart they want to see that way as well.
Hope that works!
Anurag
hi MikeFranz,
You can do the same using parameter but before creating and assigning a parameter you need to create an excel file have single column (let say Dynamic Measure) with the values as measures (Measure1, Measure2 Measure3,..) that you have to filter into the chart. Load the excel table in to lasr and add that lasr table to your report. Use the variable Dynamic Measure in the button bar. Now Create a categorical parameter and then create a calculated item like
IF ('Parameter'p = 'Measure 1')
RETURN 'Measure1'n
ELSE (
RETURN 'Measure2'n)
Hope this will work for you.
Hi there,
if you first create a calculated field with the if then else parameter realation it will work.
the new calculated field can be used in any further aggregated measure.
this works for me.
greetings. Peter.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
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.