Hi Pankaj,
I hope your concern is about only open documents. As you said, you have already created formula variables on Net due date and posting date, try the below formula and check the results.
On of Days Over due =
( NETDUEDATE < KEYDATE AND POSTINGDATE < KEYDATE) * ( KEYDATE - NETDUEDATE).
Regards,
Satya.