I have a daraframe with telephone numbers, call dates, account numbers, and IF APPLICABLE an order number and order value.
I want to tell how many calls it took to each telephone number before there WAS an order. I thought listing which call number it was would help. So sorted the by date but then I've hit a brick wall.
NUMBER CALL DATE ACC ORDERNO VALUE
07554655235 01/01/2019 XXX1 NAN NAN
07554655235 01/01/2019 XXX1 NAN NAN
07554655235 02/01/2019 XXX1 NAN NAN
01926152623 02/01/2019 AAA1 ORD13345 65.32
07554655235 03/01/2019 XXX1 NAN NAN
01125623333 04/01/2019 BBB1 NAN NAN
07554655235 05/01/2019 XXX1 NAN NAN
07554655235 05/01/2019 XXX1 NAN NAN
07554655235 06/01/2019 XXX1 ORD13345 22.95
Other than writing a function to iterate through the rows (which i believe is bad practice). Is there a way I can list out which call number it is (**for that unique number and account number), and list numbers seqentially until there is an order found and then reset back to call 1.
Notes: There are multiple telphone numbers, multiple accounts etc, each which needs to have its only sequental numbering.
My desired output is below - notice orders for AAA1 and BBB1 have their own numbering
NUMBER CALL DATE ACC ORDERNO VALUE CALL NO
07554655235 01/01/2019 XXX1 NAN NAN 1
07554655235 01/01/2019 XXX1 NAN NAN 2
07554655235 02/01/2019 XXX1 NAN NAN 3
01926152623 02/01/2019 AAA1 ORD13345 65.32 1
07554655235 03/01/2019 XXX1 NAN NAN 4
01125623333 04/01/2019 BBB1 NAN NAN 7
07554655235 05/01/2019 XXX1 NAN NAN 5
07554655235 05/01/2019 XXX1 NAN NAN 6
07554655235 06/01/2019 XXX1 ORD13345 22.95 7
07554655235 06/01/2019 XXX1 NAN NAN 1
Any suggestions?