web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to add sum on last row using excel buffer in business central

(5) ShareShare
ReportReport
Posted on by 321
Hi Guys,
I need to add total of rebate column at the end of row data using excel buffer in business central.
I have the same question (0)
  • Suggested answer
    Vahid Ghafarpour Profile Picture
    12,228 Super User 2026 Season 1 on at
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,128 Super User 2026 Season 1 on at
    Correct and reliable approach is to calculate the total in AL and then write it as the last row.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,128 Super User 2026 Season 1 on at
  • Test user Profile Picture
    321 on at
    I need to calculate this credit column sum.
    I have stored sum in one variable.
    This is makeexcelbody procedure,how to add this to a last data line row in excel?
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,128 Super User 2026 Season 1 on at
    I think you must add one extra row after the loop finishes. Something like below.
    // Inside loop (data rows)
    repeat
        ExcelBuf.NewRow;
        ExcelBuf.AddColumn(credit, false, '', false, false, false, '', ExcelBuf."Cell Type"::Number);
        TotalRebate += Round(credit);
    until Rec.Next() = 0;
    // AFTER loop – add last row
    ExcelBuf.NewRow;
    ExcelBuf.AddColumn('Total', false, '', true, false, false, '', ExcelBuf."Cell Type"::Text);
    ExcelBuf.AddColumn(TotalRebate, false, '', true, false, false, '', ExcelBuf."Cell Type"::Number);
     
  • Suggested answer
    Aman Kakkar Profile Picture
    2,977 Super User 2026 Season 1 on at
    Hi,
     
    You can just wrap up the code suggested by Khushbu inside a begin-end, and it should work fine. That's how we generally store the sum in RDLCs or Excels by calculating them in AL itself.
     
    Hope this helps.
    Aman K

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,946 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,177 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 555 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans