Thanks for your reply. I used to have a group by but I took it out to simplify things I will probably add that step in a separate query. I made small changes and used the following code
SELECT Input.Material AS Material,
Input.Plant,
([Quantity]/[SUMREZ]) AS QTY_SUOM...