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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

convert if statement to set

Hi, I wonder if its possibel to create a set expression of the below if statement ?
if
(GetSelectedCount(Week), 
sum({$<KEY_ID={'work prel'}>} [Accounted quantity]),
if(sum({$<KEY_ID={'work}>}
[Accounted quantity]) = 0
,sum({$<KEY_ID={work prel}>}
[Accounted quantity])
,sum({$<KEY_ID={'work'}>}
[Accounted quantity]))
)

3 Replies
pover
Partner - Master
Partner - Master

You could create a variable vKEYID that is equal to the following:

=if(GetSelectedCount(Week) or sum({$<KEY_ID={'work'}>} [Accounted quantity]) = 0,'work prel','work')

and then the expression would be:

sum({$<KEY_ID={'$(vKEYID)'}>} [Accounted quantity])

Regards, Karl

Not applicable
Author

Hi, Is that soultion more time efficient for the user ?

pover
Partner - Master
Partner - Master

To me it is alot cleaner y easier to write and maintain.  I don't know if it is easier to understand and I don't think it will calculate is less time.  The only way to find out is by testing it.

Karl