how to add method which calculated sum of invoices in ax 2009 report

hi, i have problem , i have two tables(data sets) custinvoicejour and commissionstrans table, i joined(1:1) them by relations,with range in custinvoicejour (invoiceaccount) and range in commissiontrans(invoiceno).

but when i run the the report,and give the the required range,it show only one record of invoicenumber against invoiceaccount ,where i check the same query in sql server, it show me more than one records,so where is problem or mistake…

also some time give me correct result,but some time show wrong.

another question is that how to sum all invoice transactions against invoiceaccount in ax standard report, i read that i will be done through method,but to how create such method, and where …

thanks…