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

Data Entity Creation where does the Margin field live?

(1) ShareShare
ReportReport
Posted on by 131
OHello,
 
In D365 F and O I wish to create a Data Entity.  I know how to do this, but I specifically require the Margin field within the Invoice Journal screen.
 
I went into the Form Information screen and can see the Control Name is 'Contribution Margin' and the Data Source is 'CustInvoiceTrans', however, if perform a SQL lookup in this table, there is no ''Contribution Margin' field.
 
Where does the Margin field live or is it calculated on-the-fly?  If so what is the calculation?
 
Thank you,
 
Michael
I have the same question (0)
  • Suggested answer
    Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Hi Michael,

    This margin field is a display method in CustInvoiceTrans table. In order to add it to the entity, you will need to use computed columns or virtual fields.

    You can check this link for more details:
    https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/data-entity-computed-columns-virtual-fields


    So you need to look at the logic of this display method, if you can write it in T-SQL then use computed columns. If not then use virtual fields. With virtual fields you can use x++ coding and call the display method but virtual fields cause performance issues that's why we prefer to use computed columns if it's possible to use them

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

  • Michael Hutcheson Profile Picture
    131 on at
    Hi,
     
    Thanks for that, that is a big help.
     
    Is the actual calculation for the Margin field stored anywhere?  I can write T-SQL but how do I know what to replicate?
     
    Regards,
     
    Michael
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Hi,

    I don't think it's stored anywhere since it requires calculation.  I just looked at the method and it seems very complex, I don't think computed column would work, you can look at the code inside the display method. So it seems you will need to go with the virtual field  -- and you can see how the performance of the entity will be affected (I mean if it's ok with you or not)



    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Hi,

    Is your issue question answered? if yes, then please verify the answers that helped.

    Thanks,
    Layan Jweihan
  • Verified answer
    Michael Hutcheson Profile Picture
    131 on at
    Hi all,
     
    I found what I was looking for - it is this Entity:
     
    Entity:                   Pending and active item prices V3
    Staging Table:      InventItemPriceV3Staging
    Target Entity:        InventItemPriceV3Entity
     
    There is a column within the Entity called [AVERAGEUNITCOST] - this is the cost used to calculated the Margin for Invoiced Order Lines.
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Hi Michael,

    There is no such field, could it be a customized field?

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans