Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ramzi-manoubi
Partner - Creator
Partner - Creator

Set analysis ignored, when table empty

Hi,

Any help understanding this is very welcome.

I try to count the number of persons which have at least 1 book.

count(   {< Book_Id = {*} >} distinct Person_Id    )

Because of a mistake (by me), the table with books is empty.

In the data model the table "books" appears, with all it's columns, but no rows.

What I had expected is that the above function would return 0 books, for every person.

In stead, the functions operates similar this function:

count(  distinct Person_Id    )

The set analysis is ignored, because the table "books" is empty.

Why? This is not what I expected.

Thank you for your interest.

1 Solution

Accepted Solutions
rubenmarin

Yes, seems it can't apply selections to field, so set analysis is ignored on that field, there is a workaround applying set analysis to an existing field, something like:

count({<Person_Id={"=Len(Book_Id)>0"}>}  distinct Person_Id)

*Not tested

Edit: Btw, I don't know how "really" works, I see it as making selections in fields, and the table is calculated using the resulting dataset, maybe if not selections are applied in one field (as it has no values to select) it's like it doesn't exists.

View solution in original post

4 Replies
rubenmarin

Hi Ramzi, have you tried?:

count({< Book_Id = {"*"} >} distinct Person_Id)

ramzi-manoubi
Partner - Creator
Partner - Creator
Author

Thank you for your time,

Yes, is the same.

Normally there're are books, so there's not really a problem.

I'm just trying to understand how it works.

rubenmarin

Yes, seems it can't apply selections to field, so set analysis is ignored on that field, there is a workaround applying set analysis to an existing field, something like:

count({<Person_Id={"=Len(Book_Id)>0"}>}  distinct Person_Id)

*Not tested

Edit: Btw, I don't know how "really" works, I see it as making selections in fields, and the table is calculated using the resulting dataset, maybe if not selections are applied in one field (as it has no values to select) it's like it doesn't exists.

ramzi-manoubi
Partner - Creator
Partner - Creator
Author

Thank you, the workaround does work, but your explanation is even more interesting.