Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mwallman
Creator III
Creator III

How to pass IF statement inside Set Analysis modifiers?

Hi,

I have a Set Analysis expression like this:

Sum({<CustomerName={'Clout'}>}Sales)

I have an IF Statement like this that inserts more modifiers if something is true:

IF(ProductName='A1' and Country='US', 'ProductName={"A1"}, Country={"US"},')

However when I insert the above IF statement inside the set analysis like this:

Sum({<

IF(ProductName='A1' and Country='US', 'ProductName={"A1"}, Country={"US"},')

CustomerName={'Clout'}

>}Sales)

It does not work.

The purpose of the IF statement is that it will be part of a larger sub IF statements which will control what goes the set analysis as modifiers.

1 Reply
marcus_sommer

You could use something like this:

Sum({<

$(=IF(ProductName='A1' and Country='US', 'ProductName={"A1"}, Country={"US"},'))

CustomerName={'Clout'}

>} Sales)

but even if this is technically possible I'm not sure that it will be sensible at all because if 'A1' and 'US' are selected in the appropriate fields the expression will by default consider them - there is no need to put them into set analysis conditions and even less to build the set analysis per if-statements.

- Marcus