Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
filippo_cardoso
Contributor III
Contributor III

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 %]))

filippo_cardoso
Contributor III
Contributor III
Author

Thx for the fast response

This expression is returning the value 0.

tresesco
MVP
MVP

Could you share your sample qvw to check?

filippo_cardoso
Contributor III
Contributor III
Author

No need.

That worked:

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

Thank you anyways