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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ziabobaz
Creator III
Creator III

Number the occurence of the field value in the script

Screenshot_1.jpg

I have a table with Date and Item, sorted asc by Date

I need to put the number of occurence of the Item, as on the picture.

Please, help, I am stuck.

 

Labels (1)
1 Solution

Accepted Solutions
PV
Contributor II
Contributor II

Order(Asc) your data by Date and Item and derive the occurrence column as below.
if(Peek(Item)=Item, Peek(Occurrence)+1,1) as Occurrence

View solution in original post

4 Replies
sunny_talwar

d seems to be appearing for the first time, why is the occurrence column showing 4?

image.png

ziabobaz
Creator III
Creator III
Author

sorry, my mistake

D is '1'

PV
Contributor II
Contributor II

Order(Asc) your data by Date and Item and derive the occurrence column as below.
if(Peek(Item)=Item, Peek(Occurrence)+1,1) as Occurrence
ziabobaz
Creator III
Creator III
Author

Ordered by Item, then Date - it worked, thank you!