We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Add a column to a report that would get sum or count values from another table

Samar A
Tera Contributor

I am building a report and need help to include columns to show the sum or count from a different table.

 

For example, I have table-1 that lists all the students and the tutor class they are enrolled in.  Table-2 tracks all the time spent in tutor classes.  The custom column would show the sum of hours for each student in each tutor class.

 

Table-1:

Student-1 Math

Student-1 Writing

Student-2 Math

 

Table-2:

Student-1 Math     07.01.24 2 hr

Student-1 Math     08.10.24 2 hr

Student-1 Math     08.13.24 1 hr

Student-1 Writing 08.03.24 1 hr

Student-2 Math     07.03.24 1 hr

Student-2 Math     08.08.24 1 hr

Student-2 Math     08.18.24 2 hr

 

Report:

Name        Class     July24   August24

Student-1 Math     2 hr       3 hr

Student-1 Writing 0            1 hr

Student-2 Math     1 hr       3 hr

 

Thanks.

4 REPLIES 4

Samar A
Tera Contributor

I missed to include in my post to ask how do you add the columns that has the sum(hours) to the report.

KB
Tera Contributor

Can you change the aggregate to sum instead of count? Otherwise on the old legacy report builder, you could add a function custom field for reports

olgaredkina
ServiceNow Employee

If you add one more field for table 2 - 'Month" (can be calculated based on the date field), you can achieve it with multi-pivot table report on top of table 2:

 

Rows: Name, Class

Column: Month

Aggregation - class duration

VyshnaviA
Tera Contributor
 

Hi

In the dashboard report, I need to display the Sum total of the numeric columns at the bottom. currently it is not showing the sum. How can I achieve this