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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Yogesh_9999
Contributor II
Contributor II

To Check if list of selected Id present in non-selected Id's

Multiple ID's contain list of Users and from the list of ID's When I select one, I want to Identify:

1. All users belonging to the selected Id.

2. Check which of them also appear in any other Id (excluding the selected)

3. Calculate the percentage of overlap user's vs all the users in the selected Id.

I am facing errors in set expression for 2nd and 3rd requirement. Appreciate any help with this.

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

Maybe using p() and/or e() to refer against the current selection state. Take the following as starting point:

1. concat(distinct User, ' + ')

2. concat({< ID = e(ID), User = p(User) >} distinct ID & ' - ' & User, ' + ')

3. count({< ID = e(ID), User = p(User) >} distinct User) / count(distinct User)

whereby you may need to consider some further conditions and/or also to nest them - means that something like: ... p({< ID = e(ID) >} User) ... is a valid possibility and may necessary to fetch the wanted sub-set.

View solution in original post

5 Replies
Yogesh_9999
Contributor II
Contributor II
Author

Can anyone help me with the expressions for this ask?
marcus_sommer

Maybe using p() and/or e() to refer against the current selection state. Take the following as starting point:

1. concat(distinct User, ' + ')

2. concat({< ID = e(ID), User = p(User) >} distinct ID & ' - ' & User, ' + ')

3. count({< ID = e(ID), User = p(User) >} distinct User) / count(distinct User)

whereby you may need to consider some further conditions and/or also to nest them - means that something like: ... p({< ID = e(ID) >} User) ... is a valid possibility and may necessary to fetch the wanted sub-set.

Yogesh_9999
Contributor II
Contributor II
Author

i used the expression below for the scenario 2 for fetching the users who are present in other Emp_id’s apart from the selected one.

count({ <[user]=P({<Emp_id={“(=only(Emp_id))"}>} [user]),Emp_id-={"$(=only(emp_id))"}}distinct [user])

but shows an error in expression. 

marcus_sommer

There are several syntax and logic issues:

count({ <[user]=P({<Emp_id={“$(=only(Emp_id))"}>} [user]),Emp_id -={"$(=only(Emp_id))"}>}distinct [user])

especially regarding to only() which is seldom necessary and in all other cases only error-prone.

Before combining and nesting the conditions apply e() and p() - wrapped with count and concat - separat against user and Emp_id to see how they behave with which selections. Getting the wanted intersection could be logically quite complicated and needs of course an appropriate data-model + data-set. Therefore developing it step by step is simpler as resolving issues in the final approach.

One insight might be that a nesting mustn't be mandatory else that the results might be reached with an approach like:

count({ Set 1 } Field) * sign(count({ Set 2} Field))

whereby the right sides acts as a boolean flag.

Yogesh_9999
Contributor II
Contributor II
Author

The 2nd expression throws an error that  “ Error in set modifier P function parameter list.