In a custom report -> I've created a field
'civicrm_contribution' => array(
'dao' => 'CRM_Contribute_DAO_Contribution',
'fields' => array(
...
'amounts_ytd' => array(
'title' => ts('Amount - YTD 2018'),
'required' => TRUE,
'dbAlias' => "SUM(CASE WHEN year(contribution_civireport.receive_date)=2018 THEN contribution_civireport.total_amount ELSE 0 END)",
),
This works nicely - it produces the correct total in the amounts_ytd column.
How would I go about filtering on this amount - to e.g. find all contacts who have amounts_ytd > $100?
Under:
'filters' => array(
What does this need to look like?
'amounts_ytd' =>
array('title' => ts('Aggregate amounts_ytd'),
'operatorType' => CRM_Report_Form::OP_FLOAT,
'type' => CRM_Utils_Type::T_FLOAT,
'??'
),