Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
good afternoon I need your help ... I want to create QlikView id for each change me the name of a program I get a different id ... annex an example of what I want to do qlikview ...
1 power rangers
2 Today
2 Today
2 Today
3 SpongeBob
4 Sylvester & Tweety Mysteries
5 today
5 today
what I need is that each change the program assigned me a new id
I did find my mistake, but handled it a little differently with Alt function. But I do like RangeSum solution, much more elegant. Thanks for sharing
Alt(If(Peek('Program') = Program, Peek('ID'), Peek('ID') + 1), 1) as ID
Try this:
LOAD Program,
If(Peek('Program') = Program, Peek('ID'), Peek('ID') + 1) as ID
FROM Source
LOAD Program,
Alt(If(Peek('Program') = Program, Peek('ID'), Peek('ID') + 1), 1) as ID
FROM Source
Attaching a sample. Script:
Table:
LOAD * Inline [
Program
power rangers
Today
Today
Today
SpongeBob
Sylvester & Tweety Mysteries
today
today
];
NewTable:
LOAD RowNo() as [Row Number],
Program,
Alt(If(Peek('Program') = Program, Peek('ID'), Peek('ID') + 1), 1) as ID
Resident Table;
Output
Row Number is added just to show that you have Today showing up thrice, otherwise table box would have just showed it once.
HTH
Best,
Sunny
Almost right. However, Peek('ID') will return NULL on the first row and since NULL + 1 => NULL, it will not work.
Try this instead:
LOAD Program,
If(Peek('Program') = Program, Peek('ID'), RangeSum(Peek('ID'), 1)) as ID
FROM Source
HIC
I did find my mistake, but handled it a little differently with Alt function. But I do like RangeSum solution, much more elegant. Thanks for sharing
Alt(If(Peek('Program') = Program, Peek('ID'), Peek('ID') + 1), 1) as ID
thank you very much was very useful help your greetings
luis espinoza
thank you