Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

luke1986
New 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

1 Solution

Accepted Solutions
marcus_malinow
Valued Contributor III

Re: Count up same values in script

Yes!

LOAD

Value,

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

FROM

[Source]

ORDER BY Value

4 Replies
marcus_malinow
Valued Contributor III

Re: Count up same values in script

Yes!

LOAD

Value,

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

FROM

[Source]

ORDER BY Value

marcus_malinow
Valued Contributor III

Re: Count up same values in script

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.

Employee
Employee

Re: Count up same values in script

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
New Contributor III

Re: Count up same values in script

Thanks Marcus, worked out really well!

Community Browser