Where with a boolean NOT !=

Where with a boolean NOT !=

Hi,

I have a SELECT which does a SUM() on some column FROM a table, WHERE another column in the table does not equal to a specific string. The NOT is not working and it is still being summed up.

I'm trying to SUM up all the payments of invoices that were NOT cancelled, the boolean NOT isn't working for me.


SELECT
"Agreement ID",
SUM("XchangedValue") as 'Aggregate RD Fees (USD)'
FROM  "All Payments Exchanged" 
WHERE "Payment Type"  = 'Research Fee (BD not Service Related)'
 OR "Payment Type"  = 'Research Services (ALM)'
 AND "Payment Status"  != 'Canceled'
 AND "Invoice Status"  != 'Invoice Cancelled'
GROUP BY  ("Agreement ID")