Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count() versus Sum() in Cognos

Status
Not open for further replies.

iren

Technical User
Joined
Mar 8, 2005
Messages
106
Location
US
Hi everybody,

I ran query in Cognos Imprompru in order to get how many members account has.

When I built my query first I used COUNT function and got 18,000. While having used SUM function I got 20,000 members.

I wonder what caused this difference. I would expect in such a case the result shou;d be the same.

Could you please explain me how these funclions differ?

Thank you in advance,
Iren
 
That is very basic. You use a count on non-numeric data, like counting the number of customers. There are 2 type of counts, count and distinct count.
The latter one removes duplicates from the result.
Sum is used on facts/measures, like getting the overall revenue for all customers.

I am not familiar with impromptu, but there is a good possibility, that 18000 is the distinct count and 20000 is somehow produced as a normal count (although sum is defined)

Ties Blom

 
Ties,
Thank you for your response. The thing is that Filter(that I applied for the query) had "Elminated duplicates" option which I chosed. So my understanding was that I used distinct Count.

However....does it count nulls? If yes, then probably it would explain the difference.....
 
Nope, nulls are excluded from a count operation.

Ties Blom

 
....and does it count zeroes?
 
Yes. (but if you remove duplicates and perform a distinct count, than every distinct values is only counted once!)

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top