Select I.Area_No,Min(Ir.Name),I.Customer_No,Min(A.Name),Sum(IIf(I.IYear=2015,Total_value*IIf(Inv_Type='1',1,-1),0)),Sum(IIf(I.IYear=2016,Total_value*IIf(Inv_Type='1',1,-1),0)),Sum(IIf(I.IYear=2017,Total_value*IIf(Inv_Type='1',1,-1),0)) From Invoices I Join VW_ACCOUNTS_CASH_CLIENTS A On I.CUSTOMER_NO=A.Ac_no  Join Inv_Areas Ir On I.Area_no=Ir.Area_No Where I.Inv_type In ('1','2') And I.IYear>=2015 Group By I.Area_No,i.Customer_No