Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can Sum of Aggr Count be negative?

Hi Qlikers!


I have the following formula in a straight table with [Seller Name] as a Dimension and this formula as an expression. I want to find, for each Seller, the number of categories where they have more than 3 accounts in the category (There is some set analysis in there but I don't think that's relevant)

=Sum(aggr(Count({$<_DateMonthStartTransactionDate={"$(vMaxYearMonthSelected)"}, _ProductCategory={'Retail'}, [Decile] = {'10'}>} DISTINCT _acntNbr) , [Seller Name], [Category])> 3)


The formula works (sort of), but it gives me the value as a negative number. I can put FABS() around the formula to get the expected result, but I don't understand how it could be negative.

How can a Sum of an aggregated Count be negative? Can a count be negative?


I am reasonably new to Qlik and sometimes feel I don't have the grasp on aggr I would like.

(values for _acntNbr are numberic and positive eg 7006553215 but I don't think that matters)

Qlikview V 11.20 x64


ps. Fantastic community here, thanks for all the help you've been so far, I'd be lost without it!

Cheers

Freddie.

2 Replies
Gysbert_Wassenaar

No, but the sum of a boolean true value will be. And you're not just aggregating a count, but you test if that count is larger than three. That is a test and will return either true (-1) or false (0).


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Of course!

That makes sense. Thanks Gysbert.