Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
Value | Output |
---|---|
A | 1 |
B | 1 |
C | 1 |
C | 2 |
C | 3 |
D | 1 |
E | 1 |
F | 1 |
F | 2 |
Thanks for your time, Lukas
Yes!
LOAD
Value,
if(Value <> peek('Value', -1), 1, peek('Output', -1) + 1) as Output
FROM
[Source]
ORDER BY Value
Yes!
LOAD
Value,
if(Value <> peek('Value', -1), 1, peek('Output', -1) + 1) as Output
FROM
[Source]
ORDER BY Value
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.
LOAD Value,
Output,
AutoNumber(RecNo(),Value) as CalculatedOutput
FROM
[https://community.qlik.com/thread/221871]
(html, codepage is 1252, embedded labels, table is @1);
Thanks Marcus, worked out really well!