Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Using peek similar function in SQL

Order_id

Customer_id

Order_date

Product_id

Quantity (Units)

O1

C1

01-Jan-2000

P1

10

O2

C2

01-Jan-2002

P2

15

O3

C3

01-Apr-2002

P3

17

O4

C4

01-Apr-2003

P1

20

O5

C4

01-Jan-2006

P2

1

O6

C1

01-May-2006

P5

7

In SQL,

I'm trying to generate the list of customers whose total ordered units is consistently lesser than the previous order. As in Total Qty purchased in the nth order is less than Total Qty purchased in n-1 th order.


Can someone please help?

Normallty, I would sum the units group by and order by Customer_id  and see the peek of data in Qlikview.

Cna somone please help with SQL?

1 Reply
m_woolf
Master II
Master II

Look at SQL Lead and Lag functions