Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

SSRS total field counting some records multiple times.

(0) ShareShare
ReportReport
Posted on by 120

Our company pays its sales reps based on cash receipts when they are received, in some cases prior to an invoice being generated. This motivates them to collect payments and makes cash flow more manageable.

The accounting dept. needs a report that shows them:

A) Total payments received

B) Payments received, invoices applied to and the memo field from the payment as this indicates if the payment was for an aged invoice or postage. In those two cases commission is not paid.

Thanks in large part to an applied payables view created by Victoria Yudin we have a report that is 99% there. The challenge we have is that the total payments is counting some records multiple times. This is occurring when a payment is applied to multiple invoices. For example if I have 4 payments of $100 each, but one of the payments was applied to two invoices, my total shows as $500 and not $400. Below is a screen grab of what it looks like.

8611.BadCalc2.jpg

As you can see the first payment is counted 4 times as it was applied to 4 different invoices.

I read about an option to create a 2nd dataset and create the sum field based off of this, but when I do that I get the total for all payments made in the specified time period.

I am hoping there is a simpler way to sum the fields.

Any thoughts or suggestions would be much appreciated. Thanks!

Below is the report itself.

SELECT
  RM20101.CUSTNMBR
  ,RM20101.DOCNUMBR
  ,RM20101.TRXDSCRN
  ,RM20101.DOCDATE
  ,RM20101.ORTRXAMT
  ,RM20101.CURTRXAM
  ,[View AR Applied Detail].Total_Applied_Amount
  ,[View AR Applied Detail].Amount_Applied
  ,[View AR Applied Detail].Applied_to_Doc_Number
  ,[View AR Applied Detail].Applied_to_Document_Date
  ,[View AR Applied Detail].Applied_To_Doc_Total
  ,[View AR Applied Detail].Applied_To_Doc_Unapplied_Amount
  ,[View AR Applied Detail].Customer_PO_Number
  ,[View AR Applied Detail].Document_Number
  ,[View AR Applied Detail].Document_Date
  ,[View AR Applied Detail].Customer_Name
  ,[View AR Applied Detail].Original_Trx_Amount
  ,[View AR Applied Detail].Current_Trx_Amount
  ,[View AR Applied Detail].Customer_ID
  ,RM00101.SLPRSNID
FROM
  RM00101
  FULL OUTER JOIN RM20101
    ON RM00101.CUSTNMBR = RM20101.CUSTNMBR
  LEFT OUTER JOIN [View AR Applied Detail]
    ON RM20101.DOCNUMBR = [View AR Applied Detail].Document_Number
WHERE
  RM20101.RMDTYPAL = 9
  AND RM20101.DOCDATE >= @DOCDATE
  AND RM20101.DOCDATE <= @DOCDATE2
  AND RM00101.SLPRSNID >= @SLPRSNID
  AND RM00101.SLPRSNID <= @SLPRSNID2

*This post is locked for comments

  • Spectrum IT Profile Picture
    Spectrum IT 120 on at
    RE: SSRS total field counting some records multiple times.

    So this ended up being impossible based on the query we were using. We created a sub-report and used that for the totals.

  • Spectrum IT Profile Picture
    Spectrum IT 120 on at
    RE: SSRS total field counting some records multiple times.

    thank you for your reply. I attempted what you suggested and it produced the same results. If I do a count on that field it will say 4 records, but is only showing the 3. It wants to count payments that are used to pay 2 more invoices multiple times.

  • Suggested answer
    RE: SSRS total field counting some records multiple times.

    You can solve it within the report itself by adding a group total to the payment number and then sum ORTRXAMT.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans