Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Using (Roll up field) SUM to calculate Unit cost on Order lines

Posted on by 155

Hi Guys,

Just figuring out how i can make a roll up field that calculates the total cost for the products on the Order Lines, The rollup field will be placed on the Order and there is a relationship with the Order Lines and Order Entity.

Right now it is only able to see this fields here.

0728.pastedimage1594189838390v1.png

I am able to notice that those fields that are in there are all simple however the field that i am trying to get a sum of is a calculated field.

2063.pastedimage1594189890862v3.png

I have checked the Unit cost field and it is a calculated field that gets the value from the productID 

5153.pastedimage1594189945918v4.png

My question is how do you think can i achieve getting a roll up field that calculates the SUM of Unit cost of all products on the order line (of a specific order) ?

Do i have to use a custom plugin for this? or can this be achievable with the solutions in dynamics already?

Also do i need to add any other relationship at all from the order lines to order if i were to add a simple field and wanted it to show up on the roll up field for sum of?

Thanks.

  • Suggested answer
    Jimmar Tangkia Profile Picture
    Jimmar Tangkia 155 on at
    RE: Using (Roll up field) SUM to calculate Unit cost on Order lines

    Thanks @Lu Hao this actually what I needed, appreciate the help.

  • Verified answer
    LuHao Profile Picture
    LuHao 40,872 on at
    RE: Using (Roll up field) SUM to calculate Unit cost on Order lines

    Hi Jimmar,

    I would recommend you use flow to set the "Unit Cost" field of Order line instead of using calculated field.

    The advantage is that the field "Unit Cost" can be used in the rollup field.

    Delete the calculated field "Unit Cost" and new a simple field with same name.

    4861.pastedimage1594196136802v2.png

    Go to https://us.flow.microsoft.com/, select the D365 environment, click Solutions, select a custom solution, new a flow.

    6406.pastedimage1594196873146v4.png

    Set the first flow as follow.

    4670.pastedimage1594197275182v5.png

    Then go back to the solution, new the second flow.

    pastedimage1594259512247v1.png

    In this way, the "Unit Cost" field of Order Line will update when change the "Existing Product" field of Order Line and change the "Current Cost" field of Product.

    Finally, we can use this field in the "Hardware Total" rollup field of Order.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans