Need to sum the number of instances of texts in a column using Query function in Google sheets

still a noob in Google Sheets. I am trying to create a sheet with the statistics with the data coming from Sales sheet . I want to sum the quantity of all items sold according to sizes. For ex. How many SHP-PUR in 4XL, (in S, M, and L) sizes are sold?

I used this code but after verifying the result, it’s wrong. It just counted the number of instances of an item in ITEM CODE and did not counted the sizes per item as I intend to do. Any help is highly appreciated.This is where the data is to be pulled. QTY is quantity sold