You want to define a calculation named total_return_value_calc that you can insert into an event condition. This calculation must determine the total value of each order returned.
From the Insert menu, click Calculation.
In the Name box, type
total_return_value_calc
In the Expression box, do the following:
In the Insertable Objects area,
click the functions tab .
Expand Summaries, click the total summary item, and drag it to the Expression box.
Click the source tab and expand Returned items (query).
Under Returned items (query), expand Returned items.
Click the Return quantity measure item, and drag it to the end of the expression.
After the source item you just inserted, type an asterisk:
*
Expand Sales (query).
Under Sales (query), expand Sales.
Click the Unit sale price measure item, and drag it to the end of the expression.
At the end of the expression, type
for
Expand Returned items (query).
Under Returned items (query), expand Order.
Under Order, click the Order number dimension item, and drag it to the end of the expression.
At the end of the expression, type a closing parenthesis:
)
The calculation expression is defined as follows:
total([Returned items (query)].[Returned items].[Return quantity]*[Sales (query)].[Sales].[Unit sale price] for [Returned items (query)].[Order].[Order number])
Click OK.
The calculation appears as a calculation icon on the data items tab.
The next step in the creating an agent tutorial is to specify an event condition.