cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Datasphere SQL view - Lead Window function not producing intended results

hudupa
Participant
0 Kudos
398

Hello,

I am trying to use the Lead window function in a SQL view to return the Date value of the next record and it coming up blank. The last record in the partition is showing Null - which is as expected. I am not sure why the dates for the previous records are not populating. Similar SQL query in HANA works fine. The issue exists just in Datasphere SQL viewer ( and Graphical view) 

Here's my SQL

SELECT "Customer_ID","Lead_Date",
	lead("Lead_Date") OVER (PARTITION BY "Customer_ID" ORDER BY "Lead_Date") AS "Next Lead Date"
FROM "LEAD_TEST"

And this is the result that I get. "Next Lead Date" should be output of the Lead window function - Basically next record's "Lead_Date" for the customer Id.

Lead Date issue - Example.png

Any thoughts on what I am missing? 

Thank you,

Hiri

Accepted Solutions (0)

Answers (0)