﻿ Rollup Summary in Tables - Twilio

# Rollup Summary in Tables

Learn how to use the Flex Insights rollup summary to create intelligent aggregation in your reports.

Rollup is a very powerful and important type of summary. It is an intelligent aggregation function that uses the original metric to calculate the aggregation (instead of simply summing or averaging individual rows). Summing and averaging of rows may lead to results that look like "sum of counts of sets that aren't mutually exclusive" or "averages of averages," which are not always the desired result.

## Rollup on count measures

When you use rollup on a column that contains a count measure it does not do a simple sum of the individual rows. Instead, rollup calculates the underlying measure without the segmentation applied in the table. A sum of individual rows may cause "sum of counts" counting the same item multiple times in some cases.

In the following example, we have two conversations. Conversation A has two segments as Mary forwards a call to Josh. The second conversation has only one segment handled by Mary.

If you create a table with the number of conversations segmented by agents you will get this result:

The segmented table attributes two conversations to Mary because she participated in them. It also attributes one conversation to Josh because Mary forwarded a call to him.

The sum of rows results in three conversations because Conversation A is counted twice - once for Mary, once for Josh.

The rollup does not simply sum the rows. Rather, it calculates the metric without considering attribution to Mary and Josh.

## Rollup on average measures

When you use rollup on a column that contains an average measure it does not do a simple average of the individual rows. Rollup calculates the underlying measure without the segmentation applied in the table. An average of individual rows may lead to calculating "averages of averages" which is often not desirable.

In the following example we have three segments handled by two different agents:

If you create a table with average talk time segmented by agents you will get this result:

The results differ because the simple average takes the averages of all agents and then calculates the average of those averages. This value may be significantly different from an overall average talk time of individual segments.

Average summary results in the formula `((1:00 + 9:00)/2 + 2:00)/2 = (5:00 + 2:00)/2 = 7:00/2 = 3:30`
Rollup summary results in the formula `(1:00 + 9:00 + 2:00)/3 = 12:00/3 = 4:00`

#### Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.

## Thank you for your feedback!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

🎉 Thank you for your feedback!
Something went wrong. Please try again.

Refer us and get \$10 in 3 simple steps!

#### Step 1

Get a free personal referral link here

Give \$10