Map and Table Calculation

AGGSUM( ) or ColumnAggregateSum() function

Returns the sum of the values of an entire column, or the sums of values per group.

Syntax

AGGSUM(ValueColumn)
AGGSUM(ValueColumn, Group)
ColumnAggregateSum(ValueColumn)
ColumnAggregateSum(ValueColumn, Group)

Input

ValueColumn is a value column
Domain type: any Value domain
Group is the 'group by' column
Domain type: any Class, ID, Group or Bool domain

Output

AGGSUM(ValueColumn) or ColumnAggregateSum(ValueColumn)

returns:

the sum of a column

Domain:

system domain Value

 

AGGSUM(ValueColumn, Group) or ColumnAggregateSum(ValueColumn, Group)

returns:

sums per group

Domain:

system domain Value

Notes:

Tips:

Usable in

TabCalc

Examples

TabCalc example:

OutCol1 = AGGSUM(Area)

OutCol2 = AGGSUM(Area,Landuse)

 

Parcel

Landuse

Area

OutCol1

OutCol2

00123

Residential

4000

50000

20000

00124

Residential

3500

50000

20000

00125

Commercial

17500

50000

17500

00126

Residential

7500

50000

20000

00127

Industrial

?

50000

?

01272

Institutional

12500

50000

12500

04625

Residential

5000

50000

20000

 

Advanced example

Suppose we have one table Province which contains all provinces of a certain country. Further, we have a table Municipality that contains information on municipalities. One column in this table (column Population) contains information on the population of each municipality. To obtain the total population of each province in the Province table, we can sum the population values of the municipalities in the Municipality table.

PopPerProv = AGGSUM(Municipality.Population, Municipality.Province)

Province.tbt

Municipality.tbt

Dom.
Province


AnyInfo

Dom.
Municipality


Population


Province

Province1

1000

Minicipality1

9920

Province1

Province2

2000

Minicipality2

4131

Province1

Province3

5000

Minicipality3

2161

Province2

Province4

4000

Minicipality4

4918

Province1

Province5

2000

Minicipality5

10461

Province3

...

...

...

 

Province.tbt after aggregation

Dom.
Province


AnyInfo


PopPerProv

Province1

1000

18969

Province2

2000

2161

Province3

5000

10461

Province4

4000

?

Province5

4000

?

...

...

...

This expression will only work when the Group column (Municipality.Province) has the same domain as the current table Province. It is usually easier to perform a join operation through the Join Column wizard. This will give the same result as the expression above, and is even more flexible. For more information, see Table calculation : Join columns.

See also: