2 Replies Latest reply: Sep 24, 2014 9:45 AM by David BONNAL

# Store an expression in a variable, with parameters

Hi there,

I'm facing an inconvenient issue. I have 4 gauge charts, with the same expression. The only difference between all of them, is a value in a set analysis condition. This value is fixed and different in every chart.

The thing is, if I want to change something in the expression, I have to do it for all the 4 charts; so 4 times the same change.

I was thinking of storing the expression in a variable, and affecting this variable in my charts. So if I want to change my expression, I do it only once, and it's appplied in the 4 charts.

My problem concerns the fixed value in the set analysis condition. Is there a way to indicate in the expression (stored in the variable) that the value is not fixed, and when I affect the variable in the chart, I give a kind of parameter, which is the value, different in the 4 charts?

E.g:

• 1st Chart expression:

Sum({\$<Category={1}>} Price)

• 2nd Chart expression:

Sum({\$<Category={2}>} Price)

• 3rd Chart expression:

Sum({\$<Category={3}>} Price)

• ...

Let's say I store this expression in a variable:

vPrices = Sum({\$<Category={1}>} Price)

Do you guys have an idea how to indicate my Category value as a dynamic parameter, and affect vPrices for each chart with a different value every time?

David

• ###### Re: Store an expression in a variable, with parameters

You could use the \$-sign + a number for any parameter, like:

vPrices:

Sum({\$<Category={\$1}>} Price)

expression:

\$(vPrices(1))

\$(vPrices(2))

....

- Marcus

• ###### Re: Store an expression in a variable, with parameters

Wow, awesome, it perfectly works!

I didn't know that.

Thanks

David