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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with Set analysis syntax

Hi,

I have a set analysis expression that used to work, but suddenly it doesn't (well, it does in one application but not in a later version of the same application), which leads me to think that I've done something wrong in the syntax.

What I want to do is to calculate the number of suppliers (UniqueCountSupplierNumber) that only exists once. I also only want to take the current month into consideration (I have a variable for that set anaylis).

count( {< $(vCurrentMonthSet), UniqueCountSupplierNumber = {"=count( {1<$(vCurrentMonthSet)>} UniqueCountSupplierNumber)=1"} >} UniqueCountSupplierNumber )

Any thoughts on how I should change the expression or how I could reach the same result in another way?

Regards, Anders

11 Replies
hic
Former Employee
Former Employee

The behaviour of Count() when a key field is used as argument has changed over the years. So, that it worked in some versions but not in others is not strange.

My view is that Count(<Key>) ought to always return NULL. It is just not well-defined.

Count(distinct >Key>) should however work, as well as Count(<CopyOfKey>)

HIC

Not applicable
Author

OK, that explains it.

And I can only agree with you regarding returning NULL - would have saved me two days work... I made a copy of the field and now it works as charm