Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Conditional Expression with selected fields

Dear folks,

I am trying to calculate an expression. In the listbox Source I have 3 fields: LATAM, EMEA and All.

If I select both LATAM and EMEA, I need to calcule the expression with values from all.

I tried that but did not work:

=
If
(
Source = 'LATAM' and 'EMEA',

Sum ({<Source='All'>}[GM %])
,
Sum([GM %])
)

You guys can help me?

Thx

4 Replies
tresesco
MVP
MVP

Try like:

=If(GetFieldSelections(Source)='EMEA, LATAM',Sum ({<Source='All'>}[GM %]),Sum([GM %]))

Anonymous
Not applicable
Author

Thx for the fast response

This expression is returning the value 0.

tresesco
MVP
MVP

Could you share your sample qvw to check?

Anonymous
Not applicable
Author

No need.

That worked:

=
If(
GetFieldSelections(Source)='EMEA, LATAM'
,
-(
Sum ([GM %]) - Sum({<[Source]=>}[GM %]))
,
Sum([GM %])
)

Thank you anyways