Prepare for the DP-600 Fabric Analytics Engineer Exam. Study with comprehensive flashcards and multiple-choice questions. Each question features hints and explanations to help you succeed. Get ready to excel on your exam!

Multiple Choice

Which function and value should you insert for <target1> and <target2> to display the previous year's sales in the given window function?

To display the previous year's sales, you access the value from the preceding row within the same partition as you order by year. The LAG function returns a value from an earlier row, and an offset of 1 moves to the immediate previous row. If there is one row per year in each partition, that previous row corresponds to last year. Therefore, the correct combination is LAG with an offset of 1. Using LEAD would fetch the next year, and an offset of 2 would skip an extra year, not give the previous year.

To display the previous year's sales, you access the value from the preceding row within the same partition as you order by year. The LAG function returns a value from an earlier row, and an offset of 1 moves to the immediate previous row. If there is one row per year in each partition, that previous row corresponds to last year. Therefore, the correct combination is LAG with an offset of 1. Using LEAD would fetch the next year, and an offset of 2 would skip an extra year, not give the previous year.