Sum all with exceptions - Get reference field name
AnsweredI have an Project Expenses app with two reference fields:
CLIENT 1
CLIENT 2
And two expenses fields:
EXPENSES 1
EXPENSES 2
Both Client 1 and Client 2 references to the same Client app. In Expenses 1 can be input expenses related to Client 1 (and same for Expenses 2/Client 2).
In my Client app I would like to sum all expenses related to the given client (across all Project Expenses) an my initial approach was:
@Sum of Expenses 1 + @Sum of Expenses 2
But since the clients sometimes end up in the Client 1 field and other times end up in the Client 2 field I need to know which Client field the reference came from and only sum the appropriate Expenses field. So the calculation I want is this:
@Sum of Expenses 1 (where the client is referenced in Client 1 field) + @Sum of Expenses 2 (where the client is referenced in Client 2 field)
Can this be done and how?
-
Hi Anders,
when you enter @sum of expenses 1 you should see 2 incoming sum-relations to that field, one via client1 and one via client 2. So you can use:
@sum of expenses 1 (select from: Expenses via client 1 (incoming)) + @sum of expenses 2 (select from: Expenses via client 2 (incoming))
Rainer
Please sign in to leave a comment.
Comments
2 comments