Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Variables issue (in stead of IF(..).. )

Dear specialists,

I am trying to use a variable to determine which data I have to use in my expression.
See the attached document for an example.

In this example I got on the right side the outcome how I want it to be.
But there I am using a large IF(..)-function like:

IF (Keuzelijst1.Keuzelijst1 = 'Been', (Sum(Been)),

IF (Keuzelijst1.Keuzelijst1 = 'BMI', (Sum(BMI)),

IF (Keuzelijst1.Keuzelijst1 = 'Buik', (Sum(Buik)),

IF (Keuzelijst1.Keuzelijst1 = 'Calorieën', (Sum(CalWeek)),

IF (Keuzelijst1.Keuzelijst1 = 'Heup', (Sum(Heup)),

IF (Keuzelijst1.Keuzelijst1 = 'Gewicht', (Sum(Gewicht)),

IF (Keuzelijst1.Keuzelijst1 = 'Vet%', (Sum(Vet%)))))))))

I want to get rite of this because it isn't flexible at all.
To accomplish this I made 2 inline tables with the names of the fields I want to use in my expression. And 2 variables that display the selected field.

What I want is to use the result as this:

SUM('variable')   (in my case SUM(vKeuze1) or SUM('vKeuze1'))

Is this possible?
And if so, how?

Thanks.


1 Solution

Accepted Solutions
frank_carlsson
Partner - Contributor II
Partner - Contributor II

Hi,

Sum ($(vKeuze1)) should work just fine.

View solution in original post

2 Replies
frank_carlsson
Partner - Contributor II
Partner - Contributor II

Hi,

Sum ($(vKeuze1)) should work just fine.

Anonymous
Not applicable
Author

Thanks, you are right.

I Typed one of them wrong that is why it didn't work.