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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
newuser
Creator II
Creator II

Set Analysis Ignore Selection Not Working

I've seen various posts on this but cannot get the below set analysis to ignore selections while respecting the set analysis criteria. Any thoughts? When I select a filter, the result changes contrary to what I expected.

sum( {1 <TranYr = {$(PreviousYear)},
Month_Paid_Adj ={"<=$(=CurrMonth)"}>}
if(placedt_all=aggr({1} nodistinct max(placedt_all),acctpol), -Payment))

Labels (1)
1 Solution

Accepted Solutions
newuser
Creator II
Creator II
Author

FYI - below is the solution I came up with. I exchanged one of the fields, Previous Year, to be a field instead of a variable. I also made sure to put {1} in the appropriate places of the AGGR formula. Between both these changes, or maybe just the latter change, my selections seem to be ignored as I want them to be.

sum( {1 <TranYr = {$(=PrevYr)},[Transaction Month],[Transaction Year],
Month_Paid_Adj ={"<=$(=CurrMonth)"}
,placedt_all={"=max({1} aggr(
nodistinct max({1} placedt_all),acctpol))"}
>} -Payment)

View solution in original post

4 Replies
edwin
Master II
Master II

you actually have two expressions here, one is a sum another is a max.  you need to make sure that the set analysis in sum is not applicable to the max expression.  that will depend on your data model. 

vinieme12
Champion III
Champion III

Notes below

 

sum( {1 <TranYr = {$(PreviousYear)},    <<if the variable PreviousYear / CurrMonth is changing when making selections then you also need to ignore selection it the variable definition
Month_Paid_Adj ={"<=$(=CurrMonth)"}>}
if(placedt_all=aggr({1} nodistinct max(placedt_all),acctpol), -Payment)) <<--here max() is not ignoring selections

also is   if(placedt_all=  will also respond to all selections

 

 

Can you post some sample data what exactly are you trying to calculate

 

 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
newuser
Creator II
Creator II
Author

I'm not sure what you mean by that, but what I did find is the IF statement in the original syntax above is causing the issue. I then tried to recast the IF statement as an extra set analysis expression. This causes the result to be lower than expected. Unfortunately, I cannot post sample data as it is sensitive. Any thoughts on how to reconfigure the below? The purpose of the last part of the set analysis expression starting with placed_all is to select the most recent placedt_all by acctpol.

sum( {1 <TranYr = {$(PreviousYear)},
Month_Paid_Adj ={"<=$(=CurrMonth)"},
placedt_all={"=aggr({1} nodistinct max(placedt_all),acctpol)"}>} -Payment)

newuser
Creator II
Creator II
Author

FYI - below is the solution I came up with. I exchanged one of the fields, Previous Year, to be a field instead of a variable. I also made sure to put {1} in the appropriate places of the AGGR formula. Between both these changes, or maybe just the latter change, my selections seem to be ignored as I want them to be.

sum( {1 <TranYr = {$(=PrevYr)},[Transaction Month],[Transaction Year],
Month_Paid_Adj ={"<=$(=CurrMonth)"}
,placedt_all={"=max({1} aggr(
nodistinct max({1} placedt_all),acctpol))"}
>} -Payment)