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

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

Distinct Count with If

Hi All,

I am struggling to convert the expression =Count(If(Enroute>=0,[Truck Reg],0)) into one which produces a distinct count of the field Truck reg whenever the condition Enroute>=0 is met.

Can someone assist with a tweak.

Thanks

5 Replies
Emmanuelle__Bustos
Partner - Specialist
Partner - Specialist

Have you tried

=If(Enroute>=0, Count([Truck Reg]),0)

Not applicable
Author

Hi Emmanuelle,

For some reason reason, the app doesn't quite like it and it produces zero, where as my first expression produces 563

Thanks

joggiek
Partner - Contributor III
Partner - Contributor III

Try this

=Count(Distinct(If(Enroute>=0,[Truck Reg],0)))

Emmanuelle__Bustos
Partner - Specialist
Partner - Specialist

If your first expression is working then add Disctinct:

=Count(Distinct(If(Enroute>=0,[Truck Reg],0)))

jerem1234
Specialist II
Specialist II

Why not set analysis?

=Count({<Enroute = {'>=0'}>} distinct [Truck Reg])

Hope this helps!