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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add Counter ToLoaded Table

Source Table:

ITEM

A0001

A0001

A0002

A0002

A0001

A0001

A0002

A0003

A0003

Result Table:

COUNTER      ITEM

1                A0001

2                A0001

3                A0001

4                A0001

1                A0002

2                A0002

3                A0002

1                A0003

2                A0003

Result Table should be sorted by ITEM then a counter from 1 to total counter per counter is created.

Thanks guys for you help.

~skip~

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use the autonumber() function with ITEM as a grouping and a unique value. Like this

autonumber(recno(), ITEM) as COUNTER

The data doesn't even have to be sorted, unless you want the COUNTER values to be assigned in an order based on some other field.

-Rob

http://robwunderlich.com

View solution in original post

9 Replies
Not applicable
Author

Hi, Try to use the recno() function it will help you.

Regards,

Nitin Jain

Not applicable
Author

Does not reset to one when new ITEM is loaded.

Not applicable
Author

Whenever your new data will be loaded the new record number will be generated.

But you don't worry if the some value is coming again and again it will have the same counter.

It won't change.

Regards,

Nitin Jain

Not applicable
Author

When I used the RecNo() same output is generated like RowNo():

COUNTER ITEM

1           A0001

2           A0001

3           A0001

4           A0001

5           A0002

6           A0002

7           A0002

8           A0003

9           A0003

The counter is continuous. What I need is same as my example.

It should reset to one when new item is loaded.

jagan
Partner - Champion III
Partner - Champion III

Hi,

Check this.

http://community.qlik.com/message/170283#170283

hope this helps you.

Regards,

Jagan.

Not applicable
Author

Hi,

Try to use the Autonumber.

For ex.  autonumber(ITEM) as counter

Hope this will help you.

Regards,

Nitin Jain

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use the autonumber() function with ITEM as a grouping and a unique value. Like this

autonumber(recno(), ITEM) as COUNTER

The data doesn't even have to be sorted, unless you want the COUNTER values to be assigned in an order based on some other field.

-Rob

http://robwunderlich.com

Not applicable
Author

Thanks Rob...

Not applicable
Author

Hello Rob,
Brilliant solution! You saved my day. Thanks very much.
Thomas