Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

ramzi-manoubi
Contributor

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

Re: Set analysis ignored, when table empty

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.

4 Replies

Re: Set analysis ignored, when table empty

Hi Ramzi, have you tried?:

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

ramzi-manoubi
Contributor

Re: Set analysis ignored, when table empty

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.

Re: Set analysis ignored, when table empty

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
Contributor

Re: Set analysis ignored, when table empty

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