8 Replies Latest reply: Apr 15, 2014 11:29 AM by Shannoy Panankoodan

# Dynamic Expression Calculation

3 charts with 3 Expressions:

1. sum(2012Sales)

2. sum(2013Sales)

3. sum(2014Sales)

Now there is a variable v_YearSelection

Can I write the expression as sum(\$'(v_YearSelection)'Sales) or something which can display the respective graph real-time based on the selection.

• ###### Re: Dynamic Expression Calculation

Like this?

Update :
create a variable

vYear

=Min(Year)

Expression For 1st Chart

SUM({<Year = {'\$(vYear)'}>}Sales)

Label for 1st Chart

=vYear & ' Sales'

Expression For 2nd Chart

SUM({<Year = {'\$(=vYear+1)'}>}Sales)

Label for 2nd Chart

=vYear+1 & ' Sales'

Expression For 3rd Chart

SUM({<Year = {'\$(=vYear+2)'}>}Sales)

Label for 3rd Chart

=vYear+2 & ' Sales'

• ###### Re: Dynamic Expression Calculation

No, I want to achieve it in 1 chart.

• ###### Re: Re: Dynamic Expression Calculation

I guess Manish  did what you expected and also find attached

• ###### Re: Dynamic Expression Calculation

Use the same in one chart... with three expressions and three labels...

Please check enclosed file..

• ###### Re: Dynamic Expression Calculation

Just wondering, whether my answer was correct or wrong ?

• ###### Re: Dynamic Expression Calculation

My bad, I think I could not figure it out then. I checked it again and it was similar.

• ###### Re: Dynamic Expression Calculation

Hi Shannoy

if the variable v_year_selection receive the value of the selected year you can just use an expression like this:

SUM (<Year = {} {'\$(v_year_selection)'}> Sales)

best regards

• ###### Re: Dynamic Expression Calculation

Hi Everybody,

I resolved this by

1. Creating variables for Current_Year (vCurrent_Year) and Previous_Year (v Previous_Year) .

2. Creating two more variables vCurrent_Sales and vPrevious_Sales.

3. Assigning vCurrent_Sales = vCurrent_Year&'Sales'

4.Similarly for vPrevious_Sales

5. Now writing expressions like sum(vCurrent_Sales) or sum(vPrevious_Sales) .