Here's a DFSORT/ICETOOL job that will do what you asked for. However, I suspect the example you showed does not fully describe what you want.
You only show one ID associated with Marketing and one ID associated with Finance. Are there really multiple IDs associated with each and if so, do you want totals or what? I also assumed that you wanted the output Revenue field as a PD value rather than as a displayable value. Is that the case?
If there is more to what you want, please show me a more complete example of the input and output records and explain more clearly what you want.