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 :
Microsoft Dynamics AX (Archived)

How to create view for BI application from a query and its display methods?

(0) ShareShare
ReportReport
Posted on by 1,813

Hii,

There is an AOT Query SalesHeading and it is being used by Sales and marketing > Reports > Transactions > Sales orders > Sales order  report.

I am creating a view from SalesHeading query but no success to get values from its display methods.

I need it for Power BI for analysis.

In the view I am trying to create computed columns but no luck.

How to convert following display methods into Computed columns in a View?

server display AmountCur  amountInvoiced()
{
    CustInvoiceJour custInvoiceJour;

    select sum(InvoiceAmount) from custInvoiceJour
        where custInvoiceJour.RefNum  == RefNum::SalesOrder
           && custInvoiceJour.SalesId == this.SalesId;

    return custInvoiceJour.InvoiceAmount;
}

server display AmountCur amountOrderedNotInvoiced()
{
    SalesLine  salesLine;
    AmountCur  ordered;

    while select salesLine
        where salesLine.SalesId     == this.SalesId
    {
        ordered += salesLine.calcLineAmountExclTax(salesLine.RemainSalesPhysical+salesLine.RemainSalesFinancial);
    }

    return ordered;
}

return (select firstonly InvoiceId
                from custInvoiceSalesLink
                index hint origSalesIdx
                order by InvoiceDate desc, InvoiceId desc
                where  custInvoiceSalesLink.OrigSalesId == this.SalesId).InvoiceId;


There are many other complex display methods like 

SalesTable.contributionMargin()
SalesTable.lastInvoice()
SalesTable.lastInvoiceDate()
SalesTable.lastPackingSlip()
SalesTable.lastPackingSlipDate()

totally stuck, what is a better approach to get data for BI application. 

need help

Thanks,

*This post is locked for comments

I have the same question (0)
  • Rana Anees Profile Picture
    1,813 on at

    help please

  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at

    Remember one thing that computed columns will be successful only if you will NOT use x++

    Watch your computed column. you have used while-select.

    SQL Server is not aware of while selected. Does that makes sense?

  • Rana Anees Profile Picture
    1,813 on at

    Thanks Shoaib, Those are display methods and I need help to convert them into computer columns.

    If you understand what i am looking for, what is best way to get the same data in a view? Thanks.

  • Guy Terry Profile Picture
    28,970 Moderator on at

    Hi Rana,

    I'm not sure I would start with display methods; whilst they might give you a hint where the data comes from, I don't think they are helping you much with getting data in to a format that a BI solution can use.

    For example, the first one, AmountCur, is showing the total invoiced amount for a single sales order (based on a value attached to the sales invoice header). I think for a BI solution, you are much better of taking all the invoice lines, and letting PowerBI calculate whatever value it needs to show you.

    Have you had a look at the views which support the standard AX cubes? For example, the SalesCube has a view for Customers (CustTableCube - gives you a nice flat view of each customer) and a view for Invoice lines (CustInvoiceTransExpanded).

    technet.microsoft.com/.../jj710378.aspx

  • Rana Anees Profile Picture
    1,813 on at

    Thanks Guy Terry,

    I am following your way.

    I taken SalesTable to the Power BI Desktop. I am making SO header level report. I need two reports Open Sales orders and Invoiced, that I filtered from SalesStatus field.

    Requirement: (SalesID, SalesName, CustAccount, SO Date, SalesStatus, SalesType, Ship Date, Invoice Date, SO Total Amount, Ordered Not Invoice Amount, Invoiced Amount, Margin)

    From SalesTable I have selected (SalesID, SalesName, CustAccount, SO Date, SalesStatus, SalesType)

    For Invoiced Sales Orders I need following fields

    (Ship Date, Invoice Date, SO Total Amount, Ordered Not Invoice Amount, Invoiced Amount, Margin)

    If SO have multiple deliveries how to get the Last Slip Date.

    For Open Sales Orders

    (SO Total Amount)

    Please guide which tables/views should I bring into BI to get all information.

    CustInvoiceTransExpanded Or CustPackingSlipTransExpanded Or CustPackingSlipLastEntries etc.

    Thanks,

  • Rana Anees Profile Picture
    1,813 on at

    Help Please

    How to calculate SO Total Amount, Ordered Not Invoice Amount, Invoiced Amount, Margin?

    Thanks

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans