in reports, what is the difference between count and sum aggregation when the field is not a int

juan9
Giga Guru

 

this is my understanding:

sum is used for int fields to add up 

count is used to count the the records, not the sum of the content of the field.

 

so why is sum different than count for a choice field?
if anything i would expect sum to be higher than count because sum is maybe adding the number of characters or something.

Screenshot 2024-08-05 at 8.56.07 AM.png

1 ACCEPTED SOLUTION

Hemanth M1
Giga Sage
Giga Sage

Hi @juan9 ,

 

Count: is Pretty simple group by : Cout of each gropup by element

Sum : Value of the field selected for sum for each record *grouped by number

 

Example:

1)In your report "111" , its stright group by on the type , number of string type field across all the table is 47,283

2)In your "22222", for the same : Open these records in a separate tab, group by choice field , you wi;ll see something like this

HemanthM1_0-1722873230464.png

now , go and get choice values for each of these types i.e

HemanthM1_1-1722873289152.png

 

now calculate i,e

12577*0 +311858*0 +4204*1+722*2+2505*3+5*4=13,183 which is less than count

 

Report(in my PDI) : Count

HemanthM1_2-1722873412439.png

 

Sum:

HemanthM1_3-1722873472630.png

 

Hope this helps!!

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

5 REPLIES 5

Robbie
Kilo Patron
Kilo Patron

Hi @juan9,

 

The count aggregation gives the number of records in each element of a visualization.

The sum aggregation shows the sum of the field you aggregate on.

 

Check the below ServiceNow Docs link for confirmation.

 

To answer your question re why the sum would differ to count for a choice field: Choice field values are of type string as evidenced by Out Of Box fields such as the task table state field. I'm not sure you will be comparing apples with apples as it were for choice fields across the system.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.



Thanks, Robbie

 

https://docs.servicenow.com/bundle/washingtondc-now-intelligence/page/use/reporting/task/aggregate-r...

Hemanth M1
Giga Sage
Giga Sage

Hi @juan9 ,

 

Count: is Pretty simple group by : Cout of each gropup by element

Sum : Value of the field selected for sum for each record *grouped by number

 

Example:

1)In your report "111" , its stright group by on the type , number of string type field across all the table is 47,283

2)In your "22222", for the same : Open these records in a separate tab, group by choice field , you wi;ll see something like this

HemanthM1_0-1722873230464.png

now , go and get choice values for each of these types i.e

HemanthM1_1-1722873289152.png

 

now calculate i,e

12577*0 +311858*0 +4204*1+722*2+2505*3+5*4=13,183 which is less than count

 

Report(in my PDI) : Count

HemanthM1_2-1722873412439.png

 

Sum:

HemanthM1_3-1722873472630.png

 

Hope this helps!!

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi @Hemanth M1 
thanks for the answer!

can you add me on linkedin:
https://www.linkedin.com/in/juanfcasas/


i need more experts in my networks haha, thanks again!

Hi @juan9 ,

 

Great it helped..

 

sent you the request on LinkedIn 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025