Hi all,
I have one client’s requirement, I have the table as like below. Here Whenever any issue happens in the product comes as Returns Quan, Del Quan is nothing but total Del Quantities in that particular month.
Return Month | Return Year | Return Quan | Del Quan | Delyear | DelMonth |
Jan | 2012 | 4 | 2959 | Dec | 2011 |
Feb | 2012 | 5 | 2841 | Jan | 2012 |
Mar | 2012 | 1 | 2637 | Feb | 2012 |
Apr | 2012 | 1 | 2586 | Mar | 2012 |
May | 2012 | 1 | 2613 | Apr | 2012 |
Client wanted to analyze the report on return month wise, Let us take For Jan 2012 return date he wanted to aggregate for last 6 months delivery Quantity. The same way for Issue Quantity we should consider the current month also.
Output for Jan 2012 row the out should be as like below
Return Month | Return Year | Return Quan | Del Quan |
Jan | 2012 | 4 | 2959 |
In another words if you are looking for return date Jan 2012, we should check the same previous month i.e. Dec 2011 in Delivery Year Moth columns, once find from that Delivery Year Month we should go previous 6 months and aggregated for Del Quan Column.
So based on return Year Month we should go and check the year and month in Del columns and get the values and aggregate it.
So the final output for this requirement is as like below.
Return Month | Return Year | Return Quan | Del Quan |
Jan | 2012 | 4 | 2959 |
Feb | 2012 | 9 | 5800 |
Mar | 2012 | 10 | 8437 |
Apr | 2012 | 11 | 11023 |
May | 2012 | 12 | 13636 |
Please let me know if you any confusion on my explanation.
Can someone please guide me how to achieve this requirement? I am struggling a lot to achieve this requirement.
Thank you much in advance for your kind help on this.
Thanks&Regards
Sree