cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

In One-Many relation ship ,how to get related records to one related dataverse table from many related dataverse table in model driven app

In One-Many relation ship ,how to get related records to one related table from many related table in model driven app

 

HI All

I have 2 dataverse tables A,B and there is one to many relationships between  A(one)--> B(Many).

 

I need to get the columns from B to A.

Also i need count of the records from B table to A.

Can anyone suggest the best approach or is it feasible in any other way in model driven App .It is bit urgent.

 

Appreciate your help in Advance.

Thanks & Regards

GS

2 ACCEPTED SOLUTIONS

Accepted Solutions
SteRe
Resolver I
Resolver I

Now I got it. 

Pretty simple issue. Just create a new column at table A: type = number, behavior = rollup. In rollup definition you select table B and as filter you define the criteria. As aggregate function you use count. 

I did a quick and dirty approach by adding my field to filter on at contact + added 3 fields at account to aggregate on:

SteRe_0-1719562024525.png

 

View solution in original post

Hi @SG013 

 

The image doesn't let me see well but I'll explain.

The field that you have created numerically in table b, always assign it the value of 1, not the one of choice.

Then in table A, is where you create the rollup and what you do there is count the field of table b, when for example the choice is equal to green

 

Jmanriquerios_0-1719563356714.png

 

 

Jmanriquerios_1-1719563394815.png

then you create a business rule to always set the value 1

Jmanriquerios_2-1719563459961.png

 

now create the count in table B

Jmanriquerios_3-1719563523693.png

 

Jmanriquerios_4-1719563591056.png

 

 

if you want to set filters

Jmanriquerios_5-1719563634432.png

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
You can accept more than one post as a solution
Follow me on Linkedin, I talk about Power Platform
Visit me!

View solution in original post

18 REPLIES 18

Hi @SG013 

 

You can have a column to count or add,

I give you two examples: you have a column in your table b that is the total sales, now it is related to table A and in it you have more related records that are part of column b.

Now you would like a field that adds up the total sales of all the records from table b to table a, then you can use a Rollup field to make this consolidated.

If you want to count it, use count instead of sum

 

Create and define calculation or rollup columns in Microsoft Dataverse - Training | Microsoft Learn

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
You can accept more than one post as a solution
Follow me on Linkedin, I talk about Power Platform
Visit me!
SteRe
Resolver I
Resolver I

Hi @SG013 ,

I'm not sure if I got what you mean by "getting columns from B to A", but I guess 1 of two options. 

So you might have a table A customer and table B quotes. 

Option 1: At customers you would like to show a list of quotes to this customer. In this case you can add a subgrid to your customer form and activated "related records". 

Option 2: At quote you have selected the customer and would like to display some details like adress. In this case you can define a quick view form at customer entity having the fields and at form of quote you can add this form then. 

 

Beside this you can do rollups like written by @Jmanriquerios or if needed you could even copy data from one record to another (most times not the best approach from data point of view)

 

HI @Jmanriquerios 

 

I am facing 2 issues here.

1.) Not able to get the related table B(many) columns in Table A ,to write calculations or formula fields

2.)In Table B ,not able to write rollup because all the columns are text or choice columns.

Eg: In Table B there is column Completed with choices: Yes,NO,NA.

I need the count of the records with values "Yes" as One rollup column

and One more column with count of values with records "No" .

I am able to get only the sum of "Item no column" ,but not count of records in the rollup.

3) If i create any rollup fields ,how i can get these fields data in Table A.

I could see challenge here,not able to get the columns to use it in the calculated field or business rules of "one to Many " A-->B relationship' records(In A table i couldnt write any calculations).Where as i can write the formulas or calculations for "many to one" B-->A relationship.(In B table i can get lookup column in the calculated fields).

 

Hope you understand the challenges i am facing

 

Appreciate your help

Many Thanks 

SG

 

Hi @SG013 

 

Create a numerical column in table b, call for example count and always assign the value 1, hide it, and then you can do the cumulative.
With this option you will be solving questions 1 and 2.
Then create a rollup column in table A called for example count and what it will do is add the count column that you created in table b

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
You can accept more than one post as a solution
Follow me on Linkedin, I talk about Power Platform
Visit me!

HI @SteRe 

I agree with you. But what i am looking here is to get those related columns in the views not in the form.I need total items count based on choice field value from related table B. Need to implement some formulas with related table B columns and columns in the table A  .

 

Hope you understand the challenge i am facing here.

 

Appreciate for your quick response

 

Many Thanks 

SG

In the form i have already added the related table views in the sub grid.

SteRe
Resolver I
Resolver I

Now I got it. 

Pretty simple issue. Just create a new column at table A: type = number, behavior = rollup. In rollup definition you select table B and as filter you define the criteria. As aggregate function you use count. 

I did a quick and dirty approach by adding my field to filter on at contact + added 3 fields at account to aggregate on:

SteRe_0-1719562024525.png

 

HI @Jmanriquerios 

In Table B i  created whole number column and in calculation i selected choice column value and set default value to 1.

Please find the below screenshot when i create  rollup column,i am unable to select related entity of newly created number column and  i am facing the below  issue

SG013_0-1719562118678.png

 

Hi @SG013 

 

The image doesn't let me see well but I'll explain.

The field that you have created numerically in table b, always assign it the value of 1, not the one of choice.

Then in table A, is where you create the rollup and what you do there is count the field of table b, when for example the choice is equal to green

 

Jmanriquerios_0-1719563356714.png

 

 

Jmanriquerios_1-1719563394815.png

then you create a business rule to always set the value 1

Jmanriquerios_2-1719563459961.png

 

now create the count in table B

Jmanriquerios_3-1719563523693.png

 

Jmanriquerios_4-1719563591056.png

 

 

if you want to set filters

Jmanriquerios_5-1719563634432.png

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
You can accept more than one post as a solution
Follow me on Linkedin, I talk about Power Platform
Visit me!
SteRe
Resolver I
Resolver I

Hi @Jmanriquerios 

why would you have a number field at your oferata table without using it? 

In you approach going for a sum as aggretation would totally fit as it would sum up those fields with "1". When using count as aggregate function it doesn't matter which field you aggregate. And as only some records should be counted, use the filter option. 

Or did I miss a part ?

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (2,023)