this is my original data Original Data | ||
Id | Date | |
A1 | 5/12/13 12:00 AM | |
A1 | 5/13/13 12:00 AM | |
A1 | 5/14/13 12:00 AM | |
A1 | 5/15/13 12:00 AM | |
B2 | 5/16/13 12:00 AM | |
B2 | 5/17/13 12:00 AM | |
C4 | 5/18/13 12:00 AM | |
C4 | 5/19/13 12:00 AM | |
C4 | 5/20/13 12:00 AM | |
D5 | 5/21/13 12:00 AM | |
E6 | 5/22/13 12:00 AM | |
I want That | ||
Id | Date | Row No |
A1 | 5/12/13 12:00 AM | 1 |
A1 | 5/13/13 12:00 AM | 2 |
A1 | 5/14/13 12:00 AM | 3 |
A1 | 5/15/13 12:00 AM | 4 |
B2 | 5/16/13 12:00 AM | 1 |
B2 | 5/17/13 12:00 AM | 2 |
C4 | 5/18/13 12:00 AM | 1 |
C4 | 5/19/13 12:00 AM | 2 |
C4 | 5/20/13 12:00 AM | 3 |
D5 | 5/21/13 12:00 AM | 1 |
E6 | 5/22/13 12:00 AM | 1 |
hi
try to use iterNo() function
see attached file
hope this helps you
Regards
Hi Zainab,
You can use the Recno() Function like below
Load
id,
Date,
Rowno() As Rowno
From Table1;
Regards,
Santhosh G
See this discussion Re: Re: Numbering Rows more examples? for an example QVW that solves your problem and two other numbering schemes you may have to deal with in the future.
Good luck,
Peter
AutoNumber(Date) as RowNo ?
hi
According to your requirement. try this code or see attachment.
[Original Data]:
LOAD Id, date(Date#(Date,'M/DD/YY hh:mm TT'),'M/DD/YY hh:mm TT') as Date_new,
if(Previous(Id)<>(Id),1, RangeSum(1,Peek(RowNo))) as RowNo ;
LOAD * Inline [
Id, Date
A1, 5/12/13 12:00 AM
A1, 5/13/13 12:00 AM
A1, 5/14/13 12:00 AM
A1, 5/15/13 12:00 AM
B2, 5/16/13 12:00 AM
B2, 5/17/13 12:00 AM
C4, 5/18/13 12:00 AM
C4, 5/19/13 12:00 AM
C4, 5/20/13 12:00 AM
D5, 5/21/13 12:00 AM
E6, 5/22/13 12:00 AM
then output like this--
Id | Date_new | RowNo |
A1 | 5/12/13 12:00 AM | 1 |
A1 | 5/13/13 12:00 AM | 2 |
A1 | 5/14/13 12:00 AM | 3 |
A1 | 5/15/13 12:00 AM | 4 |
B2 | 5/16/13 12:00 AM | 1 |
B2 | 5/17/13 12:00 AM | 2 |
C4 | 5/18/13 12:00 AM | 1 |
C4 | 5/19/13 12:00 AM | 2 |
C4 | 5/20/13 12:00 AM | 3 |
D5 | 5/21/13 12:00 AM | 1 |
E6 | 5/22/13 12:00 AM | 1 |
the data i have not load in order
Hi Zainab,
Try below syntex.
Ex:
AutoNumber(Date,Id) as RNo
Yu need to sort it if you want to do that
Do a second resident load and do an ORDER BY
Fabrice
resident load , is difficult , table size is very big