Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
baarathi
Creator III
Creator III

Custom Column in Load Script based on other columns

I need to create a custom column, such that when the customer does sales for first time, value in a column should be populated as 1 and the next time when he does value should be 0.

See the below sample input and output Data.

Input Data :

CusNumber InvoiceDate SalesAmount
Cus001 1-Jan-20 100
Cus002 2-Jan-20 200
Cus003 3-Jan-20 600
Cus001 4-Jan-20 500
Cus004 5-Jan-20 300
Cus005 6-Jan-20 200
Cus002 7-Jan-20 700
Cus003 8-Jan-20 900

 

Output Data :

CusNumber InvoiceDate SalesAmount CustomerType
Cus001 1-Jan-20 100 1
Cus002 2-Jan-20 200 1
Cus003 3-Jan-20 600 1
Cus001 4-Jan-20 500 0
Cus004 5-Jan-20 300 1
Cus005 6-Jan-20 200 1
Cus002 7-Jan-20 700 0
Cus003 8-Jan-20 900 0

  

Labels (2)
10 Replies
Kushal_Chawda

Yes. Your data should be already sorted when you load it from source. Otherwise, it won't work. Just validate that with your data if you are getting correct results that means your data is already sorted.