BookmarkSubscribeRSS Feed
MikeFranz
Quartz | Level 8

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?

 

 

3 REPLIES 3
akulkarni
Fluorite | Level 6

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

AnandSahu1
Calcite | Level 5

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.

Anand
PeterWijers
Lapis Lazuli | Level 10

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.

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
  • 2527 views
  • 0 likes
  • 4 in conversation