Saved Search Formula
I am always struggling with scenarios like this one below.
I need to get the total closed and unbilled PO amount per PO.
For example, a PO has 2 lines with the following details:
Line 1: Qty 100, Rate 5, Amount 500
Line 2: Qty 20, Rate 10, Amount 200
Let's say Line 1 was billed through 2 separate Vendor Bills.
Bill A: Qty 50, Rate 5, Amount 250
Bill B: Qty 40, Rate 5, Amount 200
Then, Line 1 was closed.
The closed and unbilled PO amount is 500 less 250 less 200 which is 50.
In this instance, I can't use the quantity, quantity billed and rate fields due to some exceptions. I must use the billed amount from the bills.
When I run a transaction saved search where closed is T and main line is F, the PO above will show 2 lines for Line 1. My columns are PO Number, Amount and Billing Transaction Amount.
There's no question that I need SUM summary type for Billing Transaction Amount since one PO line can have multiple bill lines. But how about the PO line amount? I can't use SUM because a line may appear multiple times as per example below. I can't use MAX or MIN in case there are multiple closed lines in the same PO.
I'm wondering if there is a way to say get the SUM of the Amount of each unique LINE ID per PO but SUM all lines of Billing Transaction Amount?