Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
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.

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer
MVP
MVP

You could do something like this:

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

- Marcus

View solution in original post

1 Reply
marcus_sommer
MVP
MVP

You could do something like this:

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

- Marcus