Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
dleelearn
Contributor II
Contributor II

Find the sold product which first time exist

I would like to list products that first time exist only.  Week will be my selection,  so i can know what is the new product sold on particular week.

dleelearn_0-1658370201519.png

Any idea how to do it in set analysis??

Labels (2)
1 Solution

Accepted Solutions
sidhiq91
Specialist II
Specialist II

@dleelearn  I am not sure if we can do it directly in Set analysis. So I made small change in the script before we go on to Set Analysis. Please see the script below used in the back end first:

NoConcatenate
Temp:
Load
Recno() as RecordNumber,
Product,
Week,
Sold,
if(Previous(Product)=Product and Previous(Week)<>Week,'Already Purchased','New Purchase') as Flag
Inline [
Product, Week, Sold
A,1,1
A,2,1
B,1,2
B,1,2
C,2,3
C,2,3
D,2,4
E,1,4
F,2,5
];

Exit Script;

In the frond end the expression would be: Sum({<Flag={'New Purchase'}>}Sold)

If this resolves your issue, please like and accept it as a solution.

View solution in original post

1 Reply
sidhiq91
Specialist II
Specialist II

@dleelearn  I am not sure if we can do it directly in Set analysis. So I made small change in the script before we go on to Set Analysis. Please see the script below used in the back end first:

NoConcatenate
Temp:
Load
Recno() as RecordNumber,
Product,
Week,
Sold,
if(Previous(Product)=Product and Previous(Week)<>Week,'Already Purchased','New Purchase') as Flag
Inline [
Product, Week, Sold
A,1,1
A,2,1
B,1,2
B,1,2
C,2,3
C,2,3
D,2,4
E,1,4
F,2,5
];

Exit Script;

In the frond end the expression would be: Sum({<Flag={'New Purchase'}>}Sold)

If this resolves your issue, please like and accept it as a solution.