Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I have my data as shown below.
ID | Date |
111 | 6/1/2023 |
111 | 6/2/2023 |
111 | 6/3/2023 |
123 | 6/3/2023 |
156 | 6/11/2023 |
156 | 6/12/2023 |
846 | 5/14/2023 |
846 | 5/14/2023 |
846 | 5/15/2023 |
846 | 5/16/2023 |
846 | 5/17/2023 |
I need to create an End Date and also find average number of days between Date and End Date per ID
ID | Date | End Date | Average Days |
111 | 6/1/2023 | 6/3/2023 | |
123 | 6/3/2023 | 6/3/2023 | |
156 | 6/11/2023 | 6/12/2023 | |
846 | 5/14/2023 | 5/17/2023 |
try in a straight table:
ID, min(Date), max(Date), max(Date)-min(Date)
I already tried this. This does not work. The Min Date works but the Max Date comes up as the latest date for all the IDs. So this has to be done in the script level.
it worked for me in a straight table. you can also try aggr. I've added both below: (I formatted the date in the front end cos I used to DD/MM/YYYY in the input)