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: 
luke1986
Contributor III
Contributor III

Count up same values in script

Hello Friends,

This seems like an easy problem, but i couldnt find a solution.

Is it possible to count up the same values in the Script, so that it starts counting from 1 everytime the Value changes?

Sample Data:

ValueOutput
A1
B1
C1
C2
C3
D1
E1
F1
F2

Thanks for your time,  Lukas

Labels (1)
1 Solution

Accepted Solutions
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Yes!

LOAD

Value,

if(Value <> peek('Value', -1), 1, peek('Output', -1) + 1) as Output

FROM

[Source]

ORDER BY Value

View solution in original post

4 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Yes!

LOAD

Value,

if(Value <> peek('Value', -1), 1, peek('Output', -1) + 1) as Output

FROM

[Source]

ORDER BY Value

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Note though that depending on your source you might not be able to ORDER BY. If this is the case load first into a temporary table, then use a RESIDENT load, and ORDER that.

Clever_Anjos
Support
Support

LOAD Value,

     Output,

     AutoNumber(RecNo(),Value) as CalculatedOutput

FROM

[https://community.qlik.com/thread/221871]

(html, codepage is 1252, embedded labels, table is @1);

luke1986
Contributor III
Contributor III
Author

Thanks Marcus, worked out really well!