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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Include Variable value in a Set Analysis value list

I'm trying to include a variable in a Set Analysis expression value list. However, I can't make it work.

The variable is populated by a switch

Variable

vIndicator = if(Switch='Yes','Hardware','')

Set Analysis

sum({$<Type= {'Software',$(vIndicator)}>} Amount)

Basically, I would like to include the Hardware Amount if the switch selected is 'Yes', otherwise, just display the Software Amount.

Of course, I can change my expression as such

if(Switch='Yes',sum({$<Type= {'Software','Hardware'}>} Amount), sum({$<Type= {'Software'}>} Amount))

but would like to see if I can get it to work as originally designed and without the IF logic.

TableA:

LOAD * INLINE [

Product, Type,    Amount

ProdA, Hardware,100

ProdB, Hardware,200

ProdA, Software,300

ProdB, Software,400

];

LOAD * INLINE [

Switch

Yes

No];

1 Solution

Accepted Solutions
Not applicable
Author

Hello,

See the attached. I added an " = " to the variable and changed the way you use the set analysis.

Steve

View solution in original post

2 Replies
Not applicable
Author

Hello,

See the attached. I added an " = " to the variable and changed the way you use the set analysis.

Steve

Not applicable
Author

It works.. Thanks !