Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

dennisnet
Valued Contributor III

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.


Tags (2)
1 Solution

Accepted Solutions
frank_carlsson
New Contributor II

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

Hi,

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

2 Replies
frank_carlsson
New Contributor II

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

Hi,

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

dennisnet
Valued Contributor III

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

Thanks, you are right.

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

Community Browser