Hi
I have a scenario where there is data for 12 months sales for each Entity Where in I need to consider only the first three consecutive months sales. i.e., if Jan Feb March is having continuous sales then output only Jan Feb March Numbers, if no sales then move to next three consecutive month sales. it could be Feb March Apr or Apr May Jun or Aug Sep Oct or Oct nov Dec likewise any three also not to be considered if no three consecutive month sales.
Input :
| Entity ID | Month | Sales |
| 225 | January | 0 |
| 225 | February | 700 |
| 225 | March | 0 |
| 225 | April | 400 |
| 225 | May | 0 |
| 225 | June | 700 |
| 225 | July | 300 |
| 225 | August | 200 |
| 225 | September | 200 |
| 225 | October | 300 |
| 225 | November | 0 |
| 225 | December | 500 |
| 501 | January | 0 |
| 501 | February | 0 |
| 501 | March | 1200 |
| 501 | April | 0 |
| 501 | May | 0 |
| 501 | June | 0 |
| 501 | July | 1000 |
| 501 | August | 900 |
| 501 | September | 0 |
| 501 | October | 300 |
| 501 | November | 0 |
| 501 | December | 2000 |
| 202 | January | 2000 |
| 202 | February | 6000 |
| 202 | March | 2000 |
| 202 | April | 3000 |
| 202 | May | 4000 |
| 202 | June | 400 |
| 202 | July | 300 |
| 202 | August | 300 |
| 202 | September | 100 |
| 202 | October | 5000 |
| 202 | November | 400 |
| 202 | December | 5000 |
| 170 | January | 400 |
| 170 | February | 100 |
| 170 | March | 0 |
| 170 | April | 200 |
| 170 | May | 500 |
| 170 | June | 500 |
| 170 | July | 1000 |
| 170 | August | 1000 |
| 170 | September | 2000 |
| 170 | October | 2000 |
| 170 | November | 400 |
| 170 | December | 400 |
Expected Output
| Entity ID | Month | Sales |
| 225 | June | 700 |
| 225 | July | 300 |
| 225 | August | 200 |
| 202 | January | 2000 |
| 202 | February | 6000 |
| 202 | March | 2000 |
| 170 | April | 200 |
| 170 | May | 500 |
| 170 | June | 500 |