Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Don't miss the upcoming Q&A with Qlik session on Qlik Application Automation on November 16th! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Shahzad_Ahsan
Creator III
Creator III

Count if not null

Hi Everyone

I have table like this

DateUserId
01/01/201823625
01/01/201636251
Null20148
Null32598
05/06/201814587

I want a measure to  Count UserId whose date is not null

I found lots of options but none of them is working.

1 Solution

Accepted Solutions
OmarBenSalem
Partner
Partner

If so: try:

count({<Date=-{'Null'}>}UsedId)

or

count({<Date=-{''}>}UsedId)

or


count({<Date=-{"=len(trim(Date))=0"}>}UsedId)


or


count({<Date=-{"=isNull(Date)=-1"}>}UsedId)


(depends on how ur null values are defined)

ps: Qlik does not count Null values that appear as '-' in grey

View solution in original post

6 Replies
OmarBenSalem
Partner
Partner

How are ur Null values defined? as a strgin 'Null' ?

OmarBenSalem
Partner
Partner

If so: try:

count({<Date=-{'Null'}>}UsedId)

or

count({<Date=-{''}>}UsedId)

or


count({<Date=-{"=len(trim(Date))=0"}>}UsedId)


or


count({<Date=-{"=isNull(Date)=-1"}>}UsedId)


(depends on how ur null values are defined)

ps: Qlik does not count Null values that appear as '-' in grey

View solution in original post

jonathandienst
Partner
Partner

I am not sure what the problem is here - Count() only counts non-nulls by default.

Perhaps if you provided slightly more information, the problem would be clearer.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
OmarBenSalem
Partner
Partner

I think his Null values are defined as  Strings.. not really Null values.. but maybe spaces.. don't know

Shahzad_Ahsan
Creator III
Creator III
Author

Hi

Out of 4 answers , 3 are working for me.


I don't know how my null values are defined but it appears as '-' in grey.

rajaxavier
Contributor
Contributor

Count({<AAA =- {'=len(trim(AAA))=0'} >}BBB)

or
Count({<AAA =- {''} >}BBB)