cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gumgih
Helper II
Helper II

Group table records and calculate Sum of Column values

Hi Team,

 

I'm building one Model Driven App, and want to calculate the SUM of Hours column values for same resource. 

 

Something like below.

Capture1.PNG

Capture.PNG

 

Can anyone please help.

 

Regards,

Mayank

1 ACCEPTED SOLUTION

Accepted Solutions
rampprakash
Super User
Super User

Hello @gumgih,

 

For instant calculation you need to Click Recalculate Button for the Record to get it populated instantly. Because its job will run every night to update to calculate the Rollup Fields.

 

 

But I tired from my end unfortunately its working fine from my end.

 

User Details Screen Shot:

 

rampprakash_0-1632507789994.png

 

Time Sheet Screen Shot:

 

rampprakash_1-1632507806954.png

Please find the attached unmanaged solution for your reference you can import the same and try again.

 

My Video for Your reference for Rollup and Calculated Fields : (3) Working with Calculate and Rollup Fields in Dataverse and MSCRM - Series 8 - YouTube

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

View solution in original post

8 REPLIES 8
dpoggemann
Super User
Super User

Hi @gumgih ,

 

there is a concept of Rollup fields that will allow you to total child entity records into a parent record so I would utilize this if I had a User as the parent of the timesheet records and I wanted to total the actual hours on the child timesheet record.

https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/define-rollup-... 

 

Now, overall this has always been a pretty "limiting" capability for me as I usually want to see the total hours by week, month, by subject, by user, etc.

 

You can do some of this if you created Charts related to the table where you can visually see the total actual and academic hours by subject (https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/basics/start-your-day-da...) - I now this is discussing Dynamics 365 but same approach for Dataverse...

 

Another option is Excel Templates that you can create and load in the system and access from the Timesheet view.  You can create summed tabs, pivot tables, charts, etc. based on the Timesheet data and every time you access this template it is the current data.  https://docs.microsoft.com/en-us/power-platform/admin/analyze-your-data-with-excel-templates 

 

The best method to really accomplish what you are looking to do is to utilize Power BI and connect to the source being Dataverse and you can really do whatever you want from there.  Much more capability to sum / count / slide and dice as you need.

 

I know this is not a direct answer to your original question but a table in the Dataverse with these summed values is not really possible.

 

Hope this helps.  Please Accept if answers your question or Like if helps in any way.

 

Thanks,


Drew

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew
rampprakash
Super User
Super User

Hello @gumgih,

 

Create a Lookup with Source TABLE with Resource

 

then in the Resource Table Create a ROLLUP Field then you can SUM(Related Source Table)

 

if you want condition you can add too

 

Please mark as Answer if it is helpful and provide Kudos

 

 

Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA

Blog : https://microsoftcrmtechie.blogspot.com

Hi @rampprakash 

 

Thanks for your response, i tried your suggestion but i might missing something or their is some column mismatch. Not getting any data in RollUp field.

 

gumgih_0-1632498318132.png

Sharing below the required table view.

 

gumgih_1-1632498864518.png

 

gumgih_2-1632499022972.png

 

Many Thanks in advance.

 

Regards,

Mayank

dpoggemann
Super User
Super User

Hi @gumgih ,

That is the exact issue I was mentioning with Rollups. It is not going to let you do this...  

 

Thanks,


Drew

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew
rampprakash
Super User
Super User

Hello @gumgih,

 

For instant calculation you need to Click Recalculate Button for the Record to get it populated instantly. Because its job will run every night to update to calculate the Rollup Fields.

 

 

But I tired from my end unfortunately its working fine from my end.

 

User Details Screen Shot:

 

rampprakash_0-1632507789994.png

 

Time Sheet Screen Shot:

 

rampprakash_1-1632507806954.png

Please find the attached unmanaged solution for your reference you can import the same and try again.

 

My Video for Your reference for Rollup and Calculated Fields : (3) Working with Calculate and Rollup Fields in Dataverse and MSCRM - Series 8 - YouTube

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

Prakash4691
Solution Sage
Solution Sage

@gumgih 

 

This can be achieved by using power automate. New entity needs to be created, replicate table schema same as parent entity.

 

Please find below actions w.r.t power automate.

1. Trigger when new rows gets added to parent entity dataverse table.

2. list rows for parent entity, filter rows with name so we get list of records for that name.

3. list rows for new entity, filter rows with name and set row count to 1

4. compose action to get first record from step 3

5. initialize variable for hours

6. apply to each for step 2 list rows, inside apply to each add two steps for adding the hour values

    6.1. compose action add hours variable and current item total hours
    6.2. set hours variable to compose action output

7. add condition to get length of list rows for new entity, if it is greater than 1 update the record or else create.

 

Added few screenshots of power automate actions and also end result of records in table for your reference. Test 3s is parent entity and test 4s is replica of test 3s entity.

Prakash4691_0-1632826591828.pngPrakash4691_1-1632826631942.pngPrakash4691_2-1632826679809.png

Prakash4691_3-1632826718721.png

Prakash4691_4-1632826881629.pngPrakash4691_5-1632826902757.png

 

If it answers your question, kindly give kudo and accept it as solution.

 

 

Regards,

Prakash

Hi @rampprakash ,

 

Thanks for your help.

 

It works and i'm able to achieve my requirement, in quite different way but manageable.

 

Thanks again 🙂 

 

Regards,

Mayank 

 

 

Hello @gumgih,

 

That was Awesome.

 

Please mark as Answer if it is helpful and provide Kudos


Subscribe : https://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA
Blog : https://microsoftcrmtechie.blogspot.com

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (3,774)