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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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


Labels (1)
4 Replies
Anil_Babu_Samineni
MVP
MVP

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
Champion III
Champion III

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?