Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis - using variable as fieldname

Hello community,

I have a field called "_Dimensions" which I use to select different measure fields with the "always one selected value" option.

In a variable I have if-statements to call the sum function.

This is the original version:

if(SubStringCount(Concat(_Dimensions, '|'), 'This is A'), sum([This_Is_Field_A]),

if(SubStringCount(Concat(_Dimensions, '|'), 'This is B'), sum([This_Is_Field_B]),

if(SubStringCount(Concat(_Dimensions, '|'), 'This is C'), sum([This_Is_Field_C]),Null()

)))

I can use this in a "normal" expression, however now I want to be able to write something like this:

=sum({$<[MyDimension]={"SomeFilter"}>} GetFieldSelections(_Dimensions))

So that I can grab the currently selected text in the _Dimensions field dynamically and use it in the sum function.

Also note that above field names and selection strings a written differently.

Do you know what I need to do to get this right?

Thank you.

1 Solution

Accepted Solutions
marcus_sommer

You could do something like this:

=sum({$<[MyDimension]={"SomeFilter"}>} [$(=GetFieldSelections(_Dimensions))])

- Marcus

View solution in original post

1 Reply
marcus_sommer

You could do something like this:

=sum({$<[MyDimension]={"SomeFilter"}>} [$(=GetFieldSelections(_Dimensions))])

- Marcus