Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count Zeros by Set Analysis or If Statement

Hi Guys,

Could you please advise me how to count ZEROs by set analysis or if statement.?

I am using the below statement but both of them did not work.

=count({<Sale={"0"}>} Sale)

=Sum(If(Sale =0,1))

Kind Regards,

Farrukh

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Stefan,

I think its sorted. I used the below logic with set analysis, could you please advise me is it correct?

=Sum({$<Year=, Month=, Sale={"0"}, YearMonth={">=$(=Date(MonthStart(AddMonths(Min(SaleDate),-11)),'YYYYMM'))<=$(=Date(MonthStart(AddMonths(Max(SaleDate),0)),'YYYYMM'))"}>} Sale+1)

View solution in original post

28 Replies
swuehl
MVP
MVP

'Did not work' is not a good description of what you expect to see and what you got instead.

Could you describe your model, data, context of the expressions a bit more detailed?

For example, if Sale values are floating point values, they might differ slightly from zero.

Or are you looking for counting NULL?

Anonymous
Not applicable
Author

Hi Stefan,

There are three dimensions

MonthYear

Region

Company

Expression

Sale with #,##0.000  format

Currently I'm only counting Zeros (0).

Farrukh

swuehl
MVP
MVP

Is "Sale" a field in your data model? How do its values look like?

sunny_talwar

May be like this:

Sum(Aggr(If(Sale'sExpressionHere = 0, 1, 0), MonthYear, Region, Company))

Anonymous
Not applicable
Author

Anonymous
Not applicable
Author

No Luck yet with the above statement.

sunny_talwar

There are no zeros in the above image that you have posted

swuehl
MVP
MVP

If Sale is a field in your data model and the above table shows its values, then there are no zero Sale values.

What do you expect to see?

Anonymous
Not applicable
Author

Its a sample snapshot. there are zeros. in the selected month.