count number of occurences and compute values in two files using awk

Solution 1:

This may be what you want:

awk -F '[,"]+' '
    NR==FNR { towx[$2] = $3; towy[$2] = $4; next }
            { usrx[$3] += towx[$2] * $4; usry[$3] += towy[$2] * $4 }
    END     { for (usr in usrx) printf "%s,%.1f,%.1f\n",
                                       usr, usrx[usr], usry[usr] }
' file2 file1 # file2 precedes file1