Announcements
cancel
Showing results for
Did you mean:
Contributor III

Sum with 2 criteria

Hi All,

I am working on an expression to sum if 2 criteria match

Sum({\$<[PO Total Units] = - {0}    ,  [PO Total Units]-[Original Units] < {0}     >} [PO Total Units]-[Original Units])

But it keep saying my expression is not correct

I break down the expression into

Sum({\$<[PO Total Units] = - {0}>} [PO Total Units]-[Original Units])

and

Sum({\$<[PO Total Units]-[Original Units] < {0} >} [PO Total Units]-[Original Units])

find the issue is came from

Sum({\$<[PO Total Units]-[Original Units] < {0} >} [PO Total Units]-[Original Units]).

1 Solution

Accepted Solutions
Master II
```Sum({\$<[PO Total Units] = - {0} >}
if  ([PO Total Units]-[Original Units] < 0,
[PO Total Units]-[Original Units])
)```
Learning never stops.
3 Replies
Master II
```Sum({\$<[PO Total Units] = - {0} >}
if  ([PO Total Units]-[Original Units] < 0,
[PO Total Units]-[Original Units])
)```
Learning never stops.
Contributor III
Author
Thanks! that works
Contributor III
Author

I have a question regarding this expression.

This is a sum if expression for sure, but i do not understand why if is put under the second criteria when PO ttl until - original unit <0 and why AND is not necessary to include in the expression.

In expand of this expression, i am now trying to add one more criteria when perform the sum.

the third criteria will be (PO total units - original Unit)/Original Units >=0.05

In conclude this expression will sum up only if three criteria match.

With below expression, i try to add my third criteria like below, but I am not able to get my expected result.  It still show me the result with adding the third criteria. (additional expression are now underlying.

Sum({\$<[PO Total Units] = - {0} >}
if ([PO Total Units]-[Original Units] < 0 AND
[PO Total Units]-[Original Units]/[Original Units] > 0.049
,
[PO Total Units]-[Original Units])
)

Hope someone can help.

Tags