Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis, take selections of another field

Hello

I am trying to  count IDs based on a selection of another Field  where year takes the possible values of Year2

I do it like this but it doesn't work

count({<Year=Year2>}ID)

Thanks

8 Replies
swuehl
MVP
MVP

If you want to take the possible values instead of selected values, try

count({<Year= p(Year2) >} ID)

and maybe clear selections in Year2 field, if this may render to an incompatible set:


count({<Year=p(Year2), Year2= >} ID)

rubenmarin

Or:

count({<Year={$(=Concat(distinct Year2, ','))}>}ID)

Note: swuelh's solution is better, use that if it works with your real requirements. I put this option just as a piece of knowledge.

maxgro
MVP
MVP

Count({$ <ID={"=Year=Year2"}>} ID)

Anonymous
Not applicable
Author

Count({<ID=p({<Year=$::Year2>} ID)>} ID)

Not applicable
Author

thank you for your answer, but you  have to be careful with concat(), if the field contains many values this will deteriorate your app, even  corrpt it

reddy-s
Master II
Master II

Try using GetFieldSelections function and use the results in a p() function in set Analysis.

Not applicable
Author

Thank you guys for your answers, basically I used it to do alternate state analysis in qliksense since it doesn't support the feature, so for example

perimeter1:

sum({<year=p(year1)>} Sales)

perimeter2:

sum({<year=p(year2)>} Sales)


And it works!

so it answers two questions in one,

JonnyPoole
Employee
Employee

this is great. just used this to get simpler set analysis syntax on an unrelated issue.