A financial analyst needs to calculate the month-over-month sales growth. The table `MonthlySales` has columns `Product`, `SaleMonth`, and `TotalSales`. Which window function is best suited to retrieve the previous month's sales amount on the same row as the current month's sales to facilitate the calculation?
-
A
LEAD(TotalSales) OVER (PARTITION BY Product ORDER BY SaleMonth)
-
B
LAG(TotalSales) OVER (PARTITION BY Product ORDER BY SaleMonth)
-
C
FIRST_VALUE(TotalSales) OVER (PARTITION BY Product ORDER BY SaleMonth)
-
D
ROW_NUMBER() OVER (PARTITION BY Product ORDER BY SaleMonth)