Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I would like to develop a counter on the script.
I think it is eassier with an example:
ID | DATE (DAILY) | Counter |
1111 | 01/01/2020 | 1 |
1111 | 02/01/2020 | 1 |
1111 | 03/01/2020 | 1 |
1111 | 04/01/2020 | 1 |
1111 | 05/01/2020 | 1 |
1111 | ---- | 1 |
1111 | 31/01/2020 | 1 |
1111 | 01/02/2020 | 2 |
1111 | 02/02/2020 | 2 |
1111 | 03/02/2020 | 2 |
1111 | 04/02/2020 | 2 |
1111 | 05/02/2020 | 2 |
1111 | ---- | 2 |
1111 | 29/02/2020 | 2 |
2222 | 01/01/2020 | 1 |
2222 | 02/01/2020 | 1 |
2222 | 03/01/2020 | 1 |
2222 | 04/01/2020 | 1 |
2222 | 05/01/2020 | 1 |
2222 | ---- | 1 |
2222 | 31/01/2020 | 1 |
2222 | 01/02/2020 | 2 |
2222 | 02/02/2020 | 2 |
2222 | 03/02/2020 | 2 |
2222 | 04/02/2020 | 2 |
2222 | 05/02/2020 | 2 |
2222 | ---- | 2 |
2222 | 29/02/2020 | 2 |
I need to count by ID and by Month (the date is days).
Thank you very much.
Hi @lomi89 ,
Please do the changes in the script as below. (I am assuming that we have a month field in the data. or we can create it)
load *,
AutoNumber(key) as Inumber;
load *
,ID &'_'&Month as key
inline
[
ID , DATED , Month
1111 , 01-01-2020 , 1
1111 , 02-01-2020 , 1
1111 , 03-01-2020 , 1
1111 , 04-01-2020 , 1
1111 , 05-01-2020 , 1
1111 , 31-01-2020 , 1
1111 , 01-02-2020 , 2
1111 , 02-02-2020 , 2
1111 , 03-02-2020 , 2
1111 , 04-02-2020 , 2
1111 , 05-02-2020 , 2
1111 , 29-02-2020 , 2
2222 , 01-01-2020 , 1
2222 , 02-01-2020 , 1
2222 , 03-01-2020 , 1
2222 , 04-01-2020 , 1
2222 , 05-01-2020 , 1
2222 , 31-01-2020 , 1
2222 , 01-02-2020 , 2
2222 , 02-02-2020 , 2
2222 , 03-02-2020 , 2
2222 , 04-02-2020 , 2
2222 , 05-02-2020 , 2
2222 , 29-02-2020 , 2
]