Description
The SUMX
function calculates a value for each row in a table, and then sums the number of calculated values together.
Usage
SUMX(TABLE_EXPR, EXPRESSION)
Example
You can use the SUMX
function in a pivot table to count the total number of beneficiaries in a Form containing the list of food distributions. For example, if you had a quantity field in your form with the number of kilograms of food distributed with the code KG_DISTRIBUTED
, you could write:
SUMX([Food distributions], KG_DISTRIBUTED)
The second argument can be expression in a row context, for example if we wanted to sum the total number of people receiving distributions by adding the counts from a WOMEN
field and a MEN
field:
SUMX([Food distribution], MEN + WOMEN))
This measure will calculate the value of MEN + WOMEN
for each record in the Food distribution form, and then sum all the results together.