Hi Felipe,
Have you tried to put default and offsite variable in to see if work or not?
Like this,
LAG (scalar_expression [,offset] [,default])
OVER ( [ partition_by_clause ] order_by_clause )
Please let me know if that still not working.
Regards,
Yutong