Hi guys,
This is my data
Customer | Account | Date | Balance | Status |
1 | 1001 | 01/04/2020 | -100 | Exceed |
1 | 1001 | 02/04/2020 | -150 | Exceed |
1 | 1001 | 03/04/2020 | 200 | Normal |
1 | 1001 | 20/04/2020 | -120 | Exceed |
1 | 1001 | 10/05/2020 | -110 | Exceed |
1 | 1001 | 05/06/2020 | 20 | Normal |
1 | 1001 | 30/07/2020 | -60 | Exceed |
1 | 1002 | 01/04/2020 | 180 | Normal |
1 | 1002 | 10/04/2020 | -90 | Exceed |
1 | 1002 | 30/04/2020 | 220 | Normal |
1 | 1002 | 10/05/2020 | 230 | Normal |
1 | 1002 | 12/05/2020 | -140 | Exceed |
1 | 1002 | 08/08/2020 | 110 | Normal |
2 | 1003 | 10/04/2020 | 290 | Normal |
2 | 1003 | 15/04/2020 | -300 | Exceed |
2 | 1003 | 30/04/2020 | 350 | Normal |
2 | 1003 | 15/05/2020 | 320 | Normal |
2 | 1003 | 12/07/2020 | -450 | Exceed |
2 | 1003 | 02/08/2020 | -600 | Exceed |
I want to Display for each Account:
1 - The Last Time the status change from normal to Exceed.
2 - Today Status ( Last Status ).
3 - How many time the Status change from Normal to Exceed.
4 - Total Exceed days.
This is the output:
Customer | Account | Last Time Start Exceed | Today Status | Times went Exceed | Total Exceed Days |
1 | 1001 | 30/07/2020 | Exceed | 3 | 48 |
1 | 1002 | 12/05/2020 | Normal | 2 | 108 |
2 | 1003 | 12/07/2020 | Exceed | 2 | 15 |
And
Customer | Account | Date | Balance | Status | Days To Back to normal |
1 | 1001 | 01/04/2020 | -100 | Exceed | |
1 | 1001 | 02/04/2020 | -150 | Exceed | |
1 | 1001 | 03/04/2020 | 200 | Normal | 2 |
1 | 1001 | 20/04/2020 | -120 | Exceed | |
1 | 1001 | 10/05/2020 | -110 | Exceed | |
1 | 1001 | 05/06/2020 | 20 | Normal | 46 |
1 | 1001 | 30/07/2020 | -60 | Exceed | |
1 | 1002 | 01/04/2020 | 180 | Normal | |
1 | 1002 | 10/04/2020 | -90 | Exceed | |
1 | 1002 | 30/04/2020 | 220 | Normal | 20 |
1 | 1002 | 10/05/2020 | 230 | Normal | |
1 | 1002 | 12/05/2020 | -140 | Exceed | |
1 | 1002 | 08/08/2020 | 110 | Normal | 88 |
2 | 1003 | 10/04/2020 | 290 | Normal | |
2 | 1003 | 15/04/2020 | -300 | Exceed | |
2 | 1003 | 30/04/2020 | 350 | Normal | 15 |
2 | 1003 | 15/05/2020 | 320 | Normal | |
2 | 1003 | 12/07/2020 | -450 | Exceed | |
2 | 1003 | 02/08/2020 | -600 | Exceed |
Please find attached excel for more clarification
Thank you in advance