grand total in reports

hi guys

i have doubt on reports … in my report three fields are there !.CUSTOMER NAME 2,FROM DATE 3.TO DATE

I want to fetch sum of first 10 records from january ,febraury,march how can i achieve this…please help me out

Please always add a tag for your version of AX and make clear whether your question is about a MorphX report or an SSRS report.

Also, you described a requirement but I’m not sure what’s the part you need a help with. For example, are you struggling with the calculation or with displaying it in a report?

in MORHX reports … i am struggling with filtering the data according to thedate

Although you could write such a query in T-SQL, you can’t do that in X++, therefore you’ll have to handle the logic in the application layer. Fetch records ordered by date (and other fields as needed, depending on your definition of “first”), sum first 10 for each month (ignoring the rest) and save the sum a temporary table. Like this:

while select SomeDate, Value from t
    order by SomeDate
    month = mthofyr(t.SomeDate);

    if (month != previousMonth)
        saveToTmpTable(previousMonth, total);
        counter = 0;
        total = 0;


    if (counter <= 10)
        total += t.Value;

    previousMonth = month;

saveToTmpTable(month, total);

Then you can simply display the data saved in the temporary table.