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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SQL Query for calculating Average Cost Price Unit from InventSum table

(0) ShareShare
ReportReport
Posted on by

Dear All,

I am a BI architect and i don't have much knowledge of X++ methods. I need to calculate the Average Cost Price that is being shown at the Onhand inquiry. The value is being shown by a display method in InventSum table i.e. InventSum.AverageCostPriceUnit(). I need to write a SQL query to calculate the cost as I dont know much about X++. Could anyone help me write a query or advise a simple solution so that i can get the avg cost price using SQL. If anyone can help me with which tables are involved and what will be the logic then i can write the query myself. Thanks in advance. 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Denis Macchinetti Profile Picture
    16,444 on at

    Hi

    Replicate the Business logic outside AX isn't the best practice.

    So, you have two solutions:

    1-Within SSIS use the Business Connector in order to call directly the AX methods

    2-Using an AIF Custom Service, technet.microsoft.com/.../hh509052.aspx

  • Suggested answer
    Martin Dráb Profile Picture
    237,805 Most Valuable Professional on at

    If you mean InventSum.averageCostPrice(), it calls quite a lot of business logic, several other methods etc. Writing the whole thing again and maintaining all the duplicated code outside AX doesn't look efficient.

    A better option would be letting AX calculate the values and exporting them on periodic bases. AX uses data entities for data export (you can create a new one if there is none suitable), which can be exported to the entity store. Then you can take data for your BI solution from there.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans