Subject | Getting Group By subtracting total for every record in the group |
---|---|
Author | Vishal Tiwari |
Post date | 2018-05-19T15:12:54Z |
Hi All,
I have below table requirement, where the data should be subtracted for each record in the row. For each group subtraction should be separate.
Kindly find below example.
At start of each new group total remain must be zero(group by Card_no and Card_cat)
Card_No Card_Cat In_Val Out_Val Total_Remain
1 11 100 0 100
1 11 0 20 80
1 11 25 0 105 ( (80 + 25) - 0 = 105)
====================end of first group this is first
1 12 50 0 50 (2nd part start total remain is 0+50=50)
1 12 0 30 20 (It must be i.e. 50- 30 = 20)
================end of 2nd group
2 15 60 0 60 (3rd part star
Total remain is 0+60=60)
2 15 0 35 25 (It must be i.e. 60-35=25)
====================end of 3rd part
And so on...
Thanks In Advance.
With Best Regards.
Vishal
I have below table requirement, where the data should be subtracted for each record in the row. For each group subtraction should be separate.
Kindly find below example.
At start of each new group total remain must be zero(group by Card_no and Card_cat)
Card_No Card_Cat In_Val Out_Val Total_Remain
1 11 100 0 100
1 11 0 20 80
1 11 25 0 105 ( (80 + 25) - 0 = 105)
====================end of first group this is first
1 12 50 0 50 (2nd part start total remain is 0+50=50)
1 12 0 30 20 (It must be i.e. 50- 30 = 20)
================end of 2nd group
2 15 60 0 60 (3rd part star
Total remain is 0+60=60)
2 15 0 35 25 (It must be i.e. 60-35=25)
====================end of 3rd part
And so on...
Thanks In Advance.
With Best Regards.
Vishal