Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jiwabhsmp
Contributor II
Contributor II

Qlikview Count

Hi,

I am trying to create a count for each time a a value is repeated in a column, with +1 for each new value. The below works to bring back a count (1, 2, 3 etc) for each time an item is repeated. Is there an easier way to do this?

RowNo() as XRow,
if(ColumnX= Peek('ColumnX'), Peek('ColumnXCTMP')+1,1)as ColumnXCTMP,
if(ColumnX = Peek('ColumnX'), Peek('ColumnXCTMP')+1,1)&ColumnX as ColumnX2


4 Replies
Anil_Babu_Samineni

Does these statements throws any error?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
antoniotiman
Master III
Master III

May be like this

LOAD Field,Autonumber(RowNo(),Count) as Count;
LOAD *,RowNo() as xRow,AutoNumber(Field) as Count  Inline [
Field
1
1
1
2
3
4
6
7
2
1
3
4
5
]
;

Regards,

Antonio

its_anandrjs

I believe RowNo() as XRow and RecNo() as RecNum is also ok in this case.

jiwabhsmp
Contributor II
Contributor II
Author

Hi Anand,

I have just tried this and it works perfectly - is there a way to add to an existing script for a column without load statements? For an existing column in the script with an expression as a count column?