5 Replies Latest reply: Jun 18, 2012 7:39 AM by Revlin Abbi

# Set analysis with a variable

Hi all

Using set analysis, basic example below:

=sum({\$ < Year={2007} >} Sales)

However, what I would like to do is instead of having the 2007 as an actual value I would like it to be based
on the value of a variable say called var_year.

I have tried:

=sum({\$ < Year={var_year} >} Sales)

and I have tried:

=sum({\$ < Year= var_year >} Sales)

But no luck. Any idea on how I can get this to work?

Thanks

Revlin

• ###### Re: Set analysis with a variable

Hi,

Try like this

=sum({\$ < Year={'=\$(=var_year)'} >} Sales)

Regards,

jagan.

• ###### Re: Set analysis with a variable

Hi Jagan

Just tried but no luck.

• ###### Re: Set analysis with a variable

Hi Revlin,

If the variable as a numeric value like 2009 or 2010 then the following should do

```=Sum({< Year = {\$(var_year)} >} Sales)
```

Hope that helps.

Miguel

• ###### Re: Set analysis with a variable

Perfect - that works!

Much appreciated.

Regards

Revlin

• ###### Re: Set analysis with a variable

Try this: