Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
shannoypaul
Creator
Creator

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.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

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'

View solution in original post

8 Replies
MK_QSL
MVP
MVP

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'

shannoypaul
Creator
Creator
Author

No, I want to achieve it in 1 chart.

MK_QSL
MVP
MVP

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

Please check enclosed file..

Not applicable

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

sunilkumarqv
Specialist II
Specialist II

I guess Manish  did what you expected and also find attached

shannoypaul
Creator
Creator
Author

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) .

MK_QSL
MVP
MVP

Just wondering, whether my answer was correct or wrong ?

shannoypaul
Creator
Creator
Author

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

Sorry, about that!