Hello,
I am new to the community and I am looking for some assistance with a problem. I am attempting to create a bar chart with two measures that displays the average cost of METAL WASTE and PLASTIC WASTE based on the number of panels built by a supplier per month (SUM OF WASTE COST PER MONTH/ SUM OF SUPPLIER PANELS BUILT PER MONTH )* 100'
My original code provided me the average metal/plastic waste cost based on the total sum of SUPPLIER PANELS BUILT FOR ALL MONTHS available (Not perfect, but it worked).
FABS(sum({<WASTE TYPE= {'METAL WASTE'}>}Num#([SI65C.EXTENDED_COST], '0;0-')))
/
rangesum(sum(SUPPLIER1_PANELS_BUILT) + sum(SUPPLIER2_PANELS_BUILT)) * 100
FABS(sum({<WASTE TYPE= {'PLASTIC WASTE'}>}Num#([SI65C.EXTENDED_COST], '0;0-')))
/
rangesum(sum(SUPPLIER1_PANELS_BUILT) + sum(SUPPLIER2_PANELS_BUILT)) * 100
how could I restructure the code to provide the calculation below??
'SUM OF METAL COST PER MONTH/ TOTAL SUM OF SUPPLIER PANELS PER MONTH * 100' &
'SUM OF PLASTIC COST PER MONTH/ TOTAL SUM OF SUPPLIER PANELS PER MONTH * 100'
The below chart is calculated as SUM OF METAL COST PER MONTH/ TOTAL SUM OF SUPPLIER PANELS BUILT YTD * 100 and the plastic waste is calculated the same way
![SeanJohnson22_2-1633391052023.png SeanJohnson22_2-1633391052023.png](https://community.qlik.com/t5/image/serverpage/image-id/63336i0163666D09420E28/image-size/medium?v=v2&px=400)
Table view of panels built by both suppliers. need to calculate the total panels built for each month and use it to find the average cost of metal waste/plastic waste.
![SeanJohnson22_2-1633389626276.png SeanJohnson22_2-1633389626276.png](/t5/image/serverpage/image-id/63331iB1C2EC62A993A927/image-dimensions/616x117?v=v2)
Table view of Material Waste and Extended cost(QTY*COST). Need to sum all METAL WASTE for each month and another measure to sum PLASTIC WASTE for each month and divide by total panels built by both suppliers for each month.
![SeanJohnson22_1-1633390869513.png SeanJohnson22_1-1633390869513.png](https://community.qlik.com/t5/image/serverpage/image-id/63335iFC37666E93C66D0E/image-dimensions/697x68?v=v2)