Default frames can make LAST_VALUE look broken.

Section: Dialect notes

Remember LAST_VALUE frame semantics

sql
sql
LAST_VALUE(amount) OVER (
  PARTITION BY customer_id
  ORDER BY order_date
  ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
)
Explanation

Add the full frame when you really want the final value in the partition rather than the current-row frame result.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Dialect notes
QUALIFY shortcut in some warehouses
Filter window results without wrapping a subquery.
OpenIn sheetsqlsame section
Portable alternative to QUALIFY
Use a subquery or CTE for broad compatibility.
OpenIn sheetsqlsame section
Be explicit about NULL ordering when needed
Different engines may sort NULLs differently.
OpenIn sheetsqlsame section
Inspect the plan with EXPLAIN
Start with the actual execution plan.
Create a supporting index for partition/order keys
Help the database read rows in the right order.