Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Charge amount is coming wrong.

(0) ShareShare
ReportReport
Posted on by 1,859

Dear Experts,

I have write a SQL query to get the Item charges applied on document no and charged through document no. But charge amount value is calculating wrong, what I am doing wrong. Please help me to resolve it.

SELECT a.[Document No_]"Charged Through Doc No",a.[Document Line No_]"Charged Through Doc Line No",a.[Item Charge No_],a.[Source No_]"Charged Through Doc VendorNo",

COALesce(SUM(a.[Cost Amount (Actual)]),0)-COALesce(sum(a.[Cost Amount (Non-Invtbl_)]),0)"Charge Amount",
MAX(b.[Document No_]) as [Document No_],
MAX(b.[Document Line No_]) as [Document Line No_],
MAX(b.[Source No_])"Source No.",a.Description 
FROM [TEST Private Limited$Value Entry] as a
left join [TEST Private Limited$Value Entry] as b on a.[Item Ledger Entry No_]=b.[Item Ledger Entry No_] and b.[Item Charge No_]='' and b.[Document Type] IN (2,6,10)
GROUP BY a.[Document No_],a.[Item Charge No_],a.Description,a.[Document Line No_],a.[Source No_]
HAVING a.[Item Charge No_]<>'' and max(b.[Document No_]) = 'EXP-101-19-0026'

*This post is locked for comments

  • manish.yadav Profile Picture
    manish.yadav 1,859 on at
    RE: Charge amount is coming wrong.

    We are using nav 2016 version, we are unable to find the report in NAVISION. If report is exist, please suggest us.

  • Suggested answer
    RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: Charge amount is coming wrong.

    Why you decided to go for SQL Query??

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

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,403 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans