Podio API Documentation
Items: Calculate
Performs a calculation on the given app. The calculation is made up of 4 parts; aggreation, formula, grouping and filtering, and each part will be documented below.
Aggregation
Determines how the results are aggregated. Valid options are "sum", "average", "count", "minimum" and "maximum"
Formula
The formula of th calculation, valid for all aggregations besides "count". The formula consists of a list of alternating variables or operators with a variable in each end.
Variable
A variable can either be of type "field" or of type"number". For variables of type "field" the value is the id of the field. Valid fields are "duration", "number", "calculation", "progress" and "money". For variables of type "number" the value is any number.
Operator
An operator sits between two variables and the value can be either "plus", "minus", "multiply" or "divide".
Groupings
Results can be grouped either by "field" or by "revision". When grouping by timestamps the grouping can be further refined by a sub value which can be either "date", "weekday", "week", "month" or "year".
Field
The value is the id of the field. Valid fields are "app", "member", "contact", "date", "state" and "question".
Revision
The value is the part of revision the grouping should be done on and can be either "created_on", "created_by", "last_edit_on", "last_edit_by" or "tags".
Filtering
Uses the filtering from the Filter API.
 PHP Client

PodioItem.php
PodioItem::calculate( $app_id, $attributes = array() );
 Ruby Gem

item.rb
Podio::Item.calculate( app_id, config )
 app_id*
 Required.
{
"limit": The maximum number of results to return, defaults to 15,
"aggregation": The type of aggregation, either "sum", "average", "count", "mininum" or "maximum"
"formula": The formula parts,
[
{
"type": The type of formula entry, either "field", "number" or "operator"
"value": The value which depends on the type
},
... (more parts)
],
"groupings": The groupings to be applied
[
{
"type": The type of grouping, either "field" or "revision",
"value": The value of the grouping, depends on the type,
"sub_value": The sub value of the grouping, depends on the type
},
... (more groupings)
],
"filters": The filters to apply
[
{
"key": The key for the filter,
"values": The values for the filter
},
... (more filters)
]
}
{
"total": The total of the calculation,
"groups": The groups of the calculation, if grouping is specified,
[
{
"groups": The groups for this value
[
{
"value": The value of the group,
"label": The label of the group
},
... (more groups)
],
"count": The result of the group
},
... (more results)
]
}