Skip to main content
Question

I am trying to obtain the second to last date in a column with dates. I am using the below PQL ; where should I indicate that it has to pull up 2nd to last date?

  • January 17, 2024
  • 1 reply
  • 6 views

 

CASE WHEN (ROUND_DAY("PAYMENT_TABLE"."Payment registered date")) <

PU_MAX(DOMAIN_TABLE("PAYMENT_TABLE"."CG Key"), "PAYMENT_TABLE"."Payment registered date", ROUND_DAY("PAYMENT_TABLE"."Payment registered date") IS NOT NULL

)

THEN ROUND_DAY("PAYMENT_TABLE"."Payment registered date") ELSE NULL END

 

1 reply

Try the LAG() or LEAD() window functions, those will allow you to offset by N rows based on a sorting criteria.