1

Find Maximum Number of Days Between Two Dates

Hi all,

I'm looking to build a report, based on the NAV 'Cust. Ledger Entry' table, to summarise how well customers adhere to their payment terms.

One of the columns I'm looking to include within the report is 'Maximum No. of Days to Pay', which should return the highest number found when calculating the difference between 'Closed at Date' and 'Document Date' for each entry within the applied filters.

I can't quite figure out how to achieve this.

The following formula successfully returns the unique 'number of payment days', so I essentially just want the maximum value from these rows (but without actually returning the rows and then calculating the max separately).

=@NL("Rows","Cust. Ledger Entry","=NF(,""Closed at Date"")-NF(,""Document Date"")","Closed at Date","<>''","Document Type","Invoice","Document Date",Options!$C$3,"Customer No.",$D$4)

I'm hoping it's one of those things where I'm quite close to the answer, but I just can't seem to get it right. Any help would be greatly appreciated.

Many thanks,
Simon

3 comments

Please sign in to leave a comment.