Find the latest date on each purchase order line in NetSuite

Compare three Date fields per PO item line with GREATEST, then handle missing dates with COALESCE while preserving an all-blank result.

The quick answer

Use Formula (Date) with Summary Type blank to compare three true Date fields on each PO item line. GREATEST compares expressions on that line. MAX(expression) is an aggregate expression. Summary Type Maximum explicitly summarizes result rows or groups. Neither performs the row-level three-field comparison needed here.

A bare GREATEST returns null when an input is null. To choose the latest populated date without an arbitrary fallback, use a different candidate first in each COALESCE:

GREATEST(
  COALESCE({expectedreceiptdate},{custcol_vendor_commit_date},{custcol_vendor_revised_date}),
  COALESCE({custcol_vendor_commit_date},{expectedreceiptdate},{custcol_vendor_revised_date}),
  COALESCE({custcol_vendor_revised_date},{expectedreceiptdate},{custcol_vendor_commit_date})
)

If all three fields are blank, the result stays blank. This example returns a date, not a formatted text comparison.

Before you start

You need permission to edit the Transaction saved search and access the relevant purchase-order lines. Check field availability and formula validation in your account.

Dates in the example use MM/DD/YYYY; your display format can differ.

This example uses Purchase Order Line Date Review, with Type = Purchase Order and Main Line, Tax Line and Shipping Line set to No. Its six illustrative rows are item lines, with no joins that multiply them. Those line flags alone do not guarantee item-only rows in every search. Limit Item to the intended items using the criteria available in your account. Joined fields or multiple related records can still multiply rows. Keep Summary Type blank on every result column.

The source fields are Expected Receipt Date (expectedreceiptdate), Vendor Commit Date (custcol_vendor_commit_date) and Vendor Revised Date (custcol_vendor_revised_date). The two custom IDs are examples. Verify their actual IDs in the formula field selector and confirm all three are Date fields; the custom fields must be transaction-column Date fields. Text dates and Date/Time fields require separate type, time and timezone decisions.

01. Separate row comparison from aggregation

Open Results > Columns, select Formula (Date) and open its formula popup. The starting expression incorrectly passes three fields to MAX(...). Replace that row-level comparison with GREATEST. Adding Maximum as a Summary Type would change the reporting grain instead of comparing the fields on each item line.

MAX is an aggregate; it does not compare three date fields on one line.

02. Test GREATEST and missing inputs

Replace the expression with:

GREATEST({expectedreceiptdate},{custcol_vendor_commit_date},{custcol_vendor_revised_date})

Click Set, then OK to commit the row. Keep the result label Latest Line Date and leave all Summary Types blank. Preview the six lines.

First test the comparison without null handling.

The first three results are 10/25/2026, 11/05/2026 and 01/08/2027. Each source field wins on a different line. The January 2027 result is later than the December 2026 candidates, regardless of how those dates are displayed.

Clamp Set has a populated revised date of 10/29/2026, but its commit date is blank, so bare GREATEST returns blank. Gasket Pack also returns blank with two missing dates. Bracket Set has no dates at all.

A null argument makes bare GREATEST null; it does not skip the missing field.

03. Keep every populated date

Return to the criteria, reopen Results, select the formula row and open its popup. Drag the formula text area's resize handle to make room for the expression, then enter the COALESCE version from the quick answer. The example enlarges the existing text area; its result type remains Formula (Date).

Each COALESCE returns the first non-null date in its own argument order. Starting each expression with a different candidate preserves every populated date. If any input exists, the three arguments passed to GREATEST are real dates. If all inputs are null, all three remain null.

Enlarge to inspect the full expression. No artificial historical or future date is introduced.

04. Save and verify six lines

Click Set, then OK, and Save the existing search. This overwrites its result definition; use Save As instead if you need a separate copy.

The original six document/item lines and source dates remain unchanged. Latest Line Date now reads 10/25/2026, 11/05/2026, 01/08/2027, 10/29/2026, 11/03/2026 and blank in row order. Clamp Set and Gasket Pack now return their latest available dates. Bracket Set deliberately remains blank because all three inputs are null.

Compare the full image with the three source columns; all-null remains blank.

Common questions

Why not use MAX or Summary Type Maximum?

They aggregate across rows or groups. GREATEST compares the three field values on the current line. Keep every result column's Summary Type blank for this detail-line result.

Why does bare GREATEST return blank when one field has a date?

A null argument causes this expression to return null. It does not automatically ignore the blank input. The formula must supply non-null candidates when at least one real date exists.

Why repeat COALESCE in three different orders?

One COALESCE only returns the first populated field; that date might not be the latest. Three orders retain every populated candidate for GREATEST to compare.

Should this be Formula Date or Formula Text?

Use Formula (Date) when the expression returns a date. Do not compare formatted date strings to find the latest chronological value. Display formatting and text-to-date conversion are different operations.

What should happen when all three dates are blank?

The result stays blank. This formula does not manufacture a date, and a blank result does not mean a zero date.