1. I need an new chart table with PP, salesamount, number of Sales IDs but only for sales IDs with sum(salesamount) >300
2. Br. specifikacija should show Count(Distinct SalesIDs) that are >300 and SalesIDs that where refunded (the sum Salesamount should after the refund be still >300)
F. ex. in the table "kalkulacija" you see that SALESID 868686 is a refund of InvoiceID "od Fakture" 11718-05-1. The formula needs to calculate for every salesID if there was a refund and then with it check the sum(salesamount) if >300. And the refund column should show -358.68 on SalesID 868664.
I am sure the formula in table "result" is wrong and i am something missing.
In the example PP NR: 211302 should have in table result. Promet 338.68 and Br. specifikacija 1.
File attached, thank you in advance. I hope somebody can help me.