Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to calculate sum of values in N:N relationship

(0) ShareShare
ReportReport
Posted on by 10

Hi.

I have two entities, which relate by N:N relationship. Construction entity and Material entity. Material entity has field materialValue, and Construction entity has field constructionValue which is result of sum all related materialValue. I can not use rollup field for N:N relationship. May be anybody can help me and explain how I can do this? Please forgive me if I wrote too chaotically, but this is my first experience. 

  • Javier Tafur Profile Picture
    60 on at
    RE: How to calculate sum of values in N:N relationship

    Hi, Svetlanasyo remember close this thread if the response was usefull  : )

    Best Regards.

  • Svetlanasyo Profile Picture
    10 on at
    RE: How to calculate sum of values in N:N relationship

    Thank you very much :-)

  • Verified answer
    Javier Tafur Profile Picture
    60 on at
    RE: How to calculate sum of values in N:N relationship

    This solution require a Workflow Activity, using a fetch with the agreggate sum.


    Check this links, if not are familiarize with this actions.

    Workflow Example https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/workflow/sample-create-custom-workflow-activity

    About the Fetch https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-aggregation

    Programming a workflow activity , you can get sum the materialValue after with a Update Record Step on a normal workflow to set the value on constructionValue.

  • Verified answer
    Johnny Gong Profile Picture
    6,482 Moderator on at
    RE: How to calculate sum of values in N:N relationship

    Hi Svetlanasyo,

    It's a little complicated since rollup field doesn't support N:N relationship. So you need to create a manual many-to-many relationship.

    Following article describes one example. When you create two 1:N relationships from the same entity in this manner, this can be described as a manual N:N relationship.

    And you could use the Intermediate transitional entity rollup fields to sum the materialValue field.

    community.dynamics.com/.../microsoft-dynamics-365-manual-n-n-relationship

    Hope above would help.

    Regards

    Johnny

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 91

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans