Hello Peers,
How do I distribute the remainder among top rows in order after I perform division as long as the remainder becomes 0 through a workflow? Please note that I do not want the final sum to be a Double datatype rather Integer datatype. Here's an example:
Name | Count_Name | MID | Sum | Remainder | WID |
G1 | 5 | 1 | 5 | 3 | 1 |
G1 | 5 | 1 | 5 | 3 | 2 |
G1 | 5 | 1 | 5 | 3 | 3 |
G1 | 5 | 1 | 5 | 3 | 4 |
G1 | 5 | 1 | 5 | 3 | 5 |
G2 | 4 | 2 | 10 | 3 | 1 |
G2 | 4 | 2 | 10 | 3 | 2 |
G2 | 4 | 2 | 10 | 3 | 3 |
G2 | 4 | 2 | 10 | 3 | 4 |
So, if this above shown table is source data, I would want the final sum to be as shown below:
Final Sum = Reminder to be distributed across WIDs in an order as integer values as long as remainder becomes 0.
Name | Count_Name | MID | Sum | Remainder | WID | Final Sum |
G1 | 5 | 1 | 5 | 3 | 1 | 6 |
G1 | 5 | 1 | 5 | 3 | 2 | 6 |
G1 | 5 | 1 | 5 | 3 | 3 | 6 |
G1 | 5 | 1 | 5 | 3 | 4 | 5 |
G1 | 5 | 1 | 5 | 3 | 5 | 5 |
G2 | 4 | 2 | 10 | 3 | 1 | 11 |
G2 | 4 | 2 | 10 | 3 | 2 | 11 |
G2 | 4 | 2 | 10 | 3 | 3 | 11 |
G2 | 4 | 2 | 10 | 3 | 4 | 10 |
Thanks!
Solved! Go to Solution.
I am not going to look into your case as I dont like your profile name. Let me know if you think that I got you:)
Can you clarify the example? It's mentioned that the Remainder should be equally distributed between the WIDs, however, the example does not show an equal distribution.
Sure, what I mean is... if G1 has 5 WIDs and remainder of 3, the workflow must add 1 each to top 3 records for G1 as shown above, so the final value of sum should be 6 for WIDs 1,2,3 and should remain 5 for WIDs 4 and 5. Similarly for other case G2 as well and so on if others exist.
Ponraj has a solution that will work for you.