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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis Selected Value

Hi,

This is my data:

LOAD * INLINE [

    F1, F2

    A, 1

    B, 2

    C, 3

    D, 4

];

this is my expression: SUM({$<F1={'A','B','C','D'}>} F2), which gives me 10 all the time no matter I choose either one of F1 or all of them.

I want: when I choose A, the expression gives me 1; when I choose B, the expression gives 2; when I choose nothing, the expression gives me 10. How do I do that? Thanks!

1 Solution

Accepted Solutions
maxgro
MVP
MVP

SUM({$<F1={'A','B','C','D'}>*<F1=P(F1)>} F2)

View solution in original post

11 Replies
m_woolf
Master II
Master II

=sum(F2)

Not applicable
Author

I wasn't clear about my rule:

Suppose there are 5 elements, ABCDE, and ABCD are the ones I want to restrict to:

LOAD * INLINE [

    F1, F2

    A, 1

    B, 2

    C, 3

    D, 4

    E, 5

];

I want an expression that when E is selected, the answer is 0. SUM(F2) will give me 5 when E is selected. Thanks.

ramoncova06
Partner - Specialist III
Partner - Specialist III

if I understood right you want to exclude at all time "E", but allow F1 to be "dynamic" , this should do it

=sum({<F1= {'$(=(concat({<F1-={'E'}>}F1,chr(39)&','&chr(39))))'} >}F2)

m_woolf
Master II
Master II

=sum(if(F2<>'E',F2,0))

arthur_dom
Creator III
Creator III

Something like the attached?

sinanozdemir
Specialist III
Specialist III

Maybe something like this:

c3.PNG

c1.PNG

c2.PNG

Not applicable
Author

Let's say I have a list of ABCD. When I select something in F1, only what in the list gets calculated. I could have other F1 values EFG....which I don't care, and the expression should be 0.

pratap6699
Creator
Creator

sum({<F1=>}F2)

maxgro
MVP
MVP

SUM({$<F1={'A','B','C','D'}>*<F1=P(F1)>} F2)