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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Return count where field is blank

I need to do a unique count of UserNames where the Firm field is blank

I tried this, but it didn't work

=COUNT(DISTINCT {$<Firm-={'*'}>}UserName)

any ideas?

12 Replies
venkatg6759
Creator III
Creator III

=Count({$<Firm={' '}>}Distinct UserName)

Not applicable
Author

NullCount([{set_expression}][ distinct ] [ total [<fld {, fld}>]] expression)

Returns the aggregated count of NULL values from expression or field iterated over the chart dimension(s).

You might try the nullcount function. The above was taken from QlikView help file.

Not applicable
Author

This didn't work. It returned 0

Not applicable
Author

How are your nulls formatted?

Not applicable
Author

It's a text field, which is totally blank

Not applicable
Author

Have you tried =count(distinct {$<Firm = {'',' ',null}>} UserName)

Not applicable
Author

I think my problem may be solved another way

The root issue is that this expression does not count UserNames where the Firm field is blank

=COUNT(DISTINCT {$<Firm-={'ACME','*TEST*'}>}UserName)

Is there a way to alter this to ensure it includes UserName where the Firm field is blank, whilst also excluding Firms called ACME or with TEST  in them?

Not applicable
Author

Maybe in your load script, use something like if(Firm = ' ', null, Firm) as Firm? so then all blank values are associated with nulls, then you can use nullcount?

CELAMBARASAN
Partner - Champion
Partner - Champion

Something like this

=COUNT(DISTINCT {$-<Firm={'*'}>}UserName)