Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Dayna
Creator II
Creator II

If statement and Set Analysis

<body>Hello All, A small query:- I have a set analysis expresssion that calculates the RM total when the account is 06200, and then adds another total. Now, at the moment this adds the figure for 06200 regardless if it's selected or not. What I want to do, is IF 06200 is selected or a selection within the accounts, then do this expression. Else, ignore 06200 (as it would normally). My current expression is this: <pre class="jive_text_macro jive_macro_code" jivemacro="code" ___default_attr="plain">sum({<gltr_acc={06200},pt_part_type={"R*"}> + <Rem={"N"}>} gltr_amt) </pre> I tried this: but it only works if 06200 is the only account selected (whereas multiple accounts would be selected) <pre class="jive_text_macro jive_macro_code" jivemacro="code" ___default_attr="plain"> if(gltr_acc='06200',sum({$<pt_part_type = {"R*"}>} gltr_amt),if(gltr_acc <> '06200',sum(gltr_amt))) </pre> Hope you can help me! Kind Regards, Dayna</body>

1 Solution

Accepted Solutions
vgutkovsky
Master II
Master II

Dayna,

I'm not sure why you want to do this (there are probably easier ways to accomplish whatever you're trying to do), but this should work:

if(substringcount(getfieldselections(gltr_acc),'06200')>0,
sum({<gltr_acc={'06200'},pt_part_type={"R*"}> + <Rem={'N'}>} gltr_amt),
sum({<Rem={'N'}>} gltr_amt)
)

Regards,

View solution in original post

2 Replies
Dayna
Creator II
Creator II
Author

The current expression is: sum({<gltr_acc={06200},pt_part_type={"R*"}> + <Rem={"N"}>} gltr_amt)

vgutkovsky
Master II
Master II

Dayna,

I'm not sure why you want to do this (there are probably easier ways to accomplish whatever you're trying to do), but this should work:

if(substringcount(getfieldselections(gltr_acc),'06200')>0,
sum({<gltr_acc={'06200'},pt_part_type={"R*"}> + <Rem={'N'}>} gltr_amt),
sum({<Rem={'N'}>} gltr_amt)
)

Regards,