Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
timmarsh
Contributor III
Contributor III

CountIf - help needed

Hey all,

I have a column called HOURS_SINCE_DISCHARGE.

Its contents vary between 0 and 1000.

I want to count all instances of non-zero.

For example, I have 13 records, 5 are zero (contents = "0") and 8 non zero. I am not sure if the 0 is a number or text string, but the data was imported from Excel and was a number format, value 0, in excel.

So, what what expression would I use to count non zero?

(Am new to Qlik).

I have the below, but it's counting every instance.

Count(HOURS_SINCE_DISCHARGE>0)

I have this in the Expression field in the Data section of the report element.

Thanks for helping with such a simple question. I googled an answer first, but couldn't find anything.

Tim

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=Count(If(HOURS_SINCE_DISCHARGE > 0, HOURS_SINCE_DISCHARGE)) or

=Count({<HOURS_SINCE_DISCHARGE = {'>0'}>} HOURS_SINCE_DISCHARGE)

View solution in original post

4 Replies
sunny_talwar

Try this:

=Count(If(HOURS_SINCE_DISCHARGE > 0, HOURS_SINCE_DISCHARGE)) or

=Count({<HOURS_SINCE_DISCHARGE = {'>0'}>} HOURS_SINCE_DISCHARGE)

sunny_talwar

Response went into moderation:

Capture.PNG

SreeniJD
Specialist
Specialist

Try this:

=Count(If(NOT WildMatch(hours_since_discharge,'0'),hours_since_discharge))

happy to help!

Sreeni

timmarsh
Contributor III
Contributor III
Author

Thanks Sunny! Worked perfectly.

Is there a clear user guide on matching/functions/how to write these checks? Google couldn't reveal it which is why I ended up posting.

Tim