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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
mikel_de
Creator
Creator

Question regarding set analysis

Hello,

I am a bit confused about a set analysis expression that does not work as expected when the fields in a table are empty. Here a sample script:

LET vThisYear=Year(Today());

Employees:

LOAD

*

INLINE

[

ID,Name,Salary

100,Person A, 110000

200,Person B, 120000

300,Person C, 130000

400,Person D, 140000

500,Person E, 150000

]

(DELIMITER IS ',');

Hired:

LOAD

*

INLINE

[

ID,Hired

300,2017

400,2017

500,2018

]

(DELIMITER IS ',');

If I use the expression: Count({<Hired={$(vThisYear)}>}ID) in a KPI object, it correctly returns 1.

However, if the Hired table in the script is empty (which might happen) like this:

Hired:

LOAD

*

INLINE

[

ID,Hired

]

(DELIMITER IS ',');

the same KPI object would return 5 instead of 0.

My questions are:

A) Why does this happen?

B) How to handle this so that the expression returns 0 when the table is empty?

Thank you!

14 Replies
manoj217
Creator III
Creator III

It's not a bug both tables have the common column ID so when u select ID list box it will shows the both table values.if u are removing the values in Hire table Then also list box shows 5 records. so the count is showing 5

andrei_delta
Partner - Creator III
Partner - Creator III

Set analysis behaves like that when is evaluating fields with null values

pablolabbe
Partner Ambassador
Partner Ambassador

Maybe Henric hic‌ can explain this behavior.

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button! | Follow me on Linkedin
hic
Former Employee
Former Employee

I'd say it's a bug. I'll report it.

HIC

mikel_de
Creator
Creator
Author

Good to know, thanks!