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 :
Finance | Project Operations, Human Resources, ...
Answered

Get previous value record data provider class SSRS Report

(0) ShareShare
ReportReport
Posted on by 73

Hallo, i'm new in develop and need Help for my case.

pastedimage1675064049177v1.png

i want to create report and get value like yellow record.

row 1: balance due = invoice amount - payment amount

row 2,3,4... : balance due = balancedue from row 1(previous) - payment amount from record active

how to i convert to my code.

my code:

tmp.InvoiceAmount = custInvoiceJour.InvoiceAmount;
tmp.PaymentAmount = custSettlement.SettleAmountCur;
tmp.BalanceDue = tmp.InvoiceAmount - tmp.PaymentAmount;

i know its read record line not get value from previous.

  • Verified answer
    GirishS Profile Picture
    27,843 Moderator on at

    Hi Dodi,

    Try to save the last balance due amount in buffer variable during each loop and use that variable to calculate due amount. Also initialize integer variable so that for 1st record you can subtract invoice and payment amount and for upcoming records you can use that balanceDue buffer. Try below code and see whether its suit your scenario. Make sure your query run will loop from the highest amount.

    //declare variable for balance due amount and globally.
    Amount balanceDue;
    integer i = 0;
    tmp.InvoiceAmount = custInvoiceJour.InvoiceAmount;
    tmp.PaymentAmount = custSettlement.SettleAmountCur;
    if(i == 0)
    {
        tmp.BalanceDue = tmp.InvoiceAmount - tmp.PaymentAmount;
    }
    else
    {
        tmp.BalanceDue = balanceDue - tmp.PaymentAmount
    }
    //assign value to balanceDue buffer.
    balanceDue = tmp.balanceDue;
    i  = 1;

    Thanks,

    Girish S.

  • Martin Dráb Profile Picture
    240,744 Most Valuable Professional on at

    You could also handle it in the report with RunningValue(). Check out SSRS: Create a running total using RunningValue, for example.

  • Dodi Profile Picture
    73 on at

    Thanks Girish,  its Helping me a lot

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 366

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 360 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans