Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
test14
Contributor II
Contributor II

Flag first occurrence of customer during load

hello community,

I am loading a sql table with the columns order_ID, customer and a order_date via editor.

What I want to do is to create a new column to identify first orders.
So, if the customer name never appeared before that order gets a 1,
if the customer name appears before it gets a 0.

I don't know how to solve it, it should actually be fairly easy.
can anyone help me with that?

1 Solution

Accepted Solutions
bramkn
Partner - Specialist
Partner - Specialist

If you sort the table by order_date. and then use something like: "if(exists(customer),0,1)" to create that field you want. 

View solution in original post

3 Replies
bramkn
Partner - Specialist
Partner - Specialist

If you sort the table by order_date. and then use something like: "if(exists(customer),0,1)" to create that field you want. 

test14
Contributor II
Contributor II
Author

The table I have is actually sorted by date. When I try this formular, every line gets a 0.
Do I need to specify the order, does that make a diference?

I mean, even if its not sorted, it should mark some orders,
since there are definetly customers who ordered only one time.

test14
Contributor II
Contributor II
Author

I found the mistake. I used Trim(Lower(Customer)) to clean the entries.
That's why it couldn't be matched.

Without that your solution works perfetly.
Thanks for the support.