Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count if expression

Hi,

I'm new to Qlikview and have come across a blocker that I've not been able to get around.

I want to carry out a variable count of one column and based on that outcome carry out a Count DISTINCT of another column.

To put into context;

MFPN          Unique ID

1                         9

2                         NULL

3                         8

1                         NULL

1                         7

2                         6

I want to look at Unique ID and where the value doesn't = NULL I want to carry out a Distinct Count of MFPN

I have tried

Count (DISTINCT MFPN (if ([Unique ID], (not 'NULL'), ([Unique ID])))

I know its wrong but its as close as I can get!!

Any help will be apprecited.

Thanks,

Phil

1 Solution

Accepted Solutions
whiteline
Master II
Master II

=count({$<[Unique ID]-={"NULL"}>}  [Unique ID])

View solution in original post

7 Replies
rajni_batra
Specialist
Specialist

Try

Count (DISTINCT MFPN (if ([Unique ID]<> 'NULL'), ([Unique ID])))

Not applicable
Author

Thanks Rajni, however, that throws back an error with the use of the 'if' expression.

Any thoughts?

rajni_batra
Specialist
Specialist

can u exactly show  me what result r u expecting exactly from this kind of expression

Not applicable
Author

In the context of the example I gave it should bring back a count of 4 as 2 of the MFPN's have NULL in there corresponding Unique ID field and I want to exclude the NULL values from the DISTINCT Count.

Does that help?

rajni_batra
Specialist
Specialist

=count(if([Unique ID]<>'NULL',[Unique ID]))

so i think it would be good enough

whiteline
Master II
Master II

=count({$<[Unique ID]-={"NULL"}>}  [Unique ID])

Not applicable
Author

Thanks Whiteline. Worked perfectly