Drupal 8 - Views - Get the sum for each group of data

By xngo on June 13, 2019

Drupal Views has the option for grouping view results. But it can do much more. Beside grouping results, it can also get the total of each group. In Views, this is called Aggregation. For example, if you want the total production of each calendar week. The following data

Calendar Week  Production
    1               9227
    1               8946
    1               9492
    2               9235
    2               8944
    2               9750
    3               9221
    3               8961
    3               9878

will become

Calendar Week  Production(Total)
    1            27,665
    2            27,929
    3            28,060

Here is a video showing how to do it.

D8 - Views - Get the sum for each group of data

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.