cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KnipeBolland
Frequent Visitor

Add Outputs Together

Hi,

 

I am building  a timesheet whichthe users enters the time they have worked on a project. What I want to do then is add the time worked on that entry to a secondary list which holds the total hours worked on a project. The idea is that with ever entry the time will total hours worked on a project will increase.

 

I have tried using the add function under the compose element but I cannot seem to get the function to work to update the field value.

 

Can anyone offer any help?

 

Many Thanks,

 

Karl

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @KnipeBolland,

 

Could you please share a screenshot of your flow's configuration?

Could you please show a bit more about the timesheet and the secondary list that you mentioned?

Further, do you want to add each worked hour entered in your timesheet into the total hours within the secondary list?

 

I suppose that there is a column which holds the total hours worked on a project in your secondary list, is it true? I have created a timesheet list (a SharePoint list) and a Secondary list (a SharePoint list) on my side and the data structure of it as below:24.JPG

Note: The ProjectName column and UserName column are both Single line of text type column, the Workhours column is a Number type column.

25.JPG

Note: The TotalWorkHours column is a Number type column and the default value of it is 0.

 

I have made a test on my side and please take a try with following workaround:

  • Add a "When an item is created" trigger, specify Site Address and List Name.
  • Add a Variables-> "Initialize variable" action, Name set to OriginalHoursValue, Type set to Float and Value set to empty.
  • Add a "Get items" action, specify Site Address and List Name, Filter Query field set to following formula:
ProjectName eq 'ProjectName dynamic content of the trigger'

Note: The dynamic content is wrapped with single quotes within above formula.

 

  • Add a "Apply to each" action, input parameter set to output of "Get items" action.
  • Within "Apply to each" action, add a "Set variable" action, Name choose OriginalHoursValue variable, Value set to TotalWorkHours dynamic content of "Get items" action.

         Add a "Increment variable" action, Name choose OriginalHoursValue variable, Value set to WorkHours dynamic content of the trigger.

         Add a "Update item" action, specify Site Address and List Name, Id field set to ID dynamic content of "Get items" action, TotalWorkHours field set to OriginalHoursValue variable.

 

Note: The OriginalHoursValue variable is used to store original worked hours value within my secondary list.

 

Image reference:26.JPG

 

27.JPG

The flow works successfully as below:28.JPG

When I entry two records in my timesheet list as below:29.JPG

The secondary list calculates well as below:30.JPG

 

 

 

Best regards,

Kris

 

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xida-msft
Community Support
Community Support

Hi @KnipeBolland,

 

Could you please share a screenshot of your flow's configuration?

Could you please show a bit more about the timesheet and the secondary list that you mentioned?

Further, do you want to add each worked hour entered in your timesheet into the total hours within the secondary list?

 

I suppose that there is a column which holds the total hours worked on a project in your secondary list, is it true? I have created a timesheet list (a SharePoint list) and a Secondary list (a SharePoint list) on my side and the data structure of it as below:24.JPG

Note: The ProjectName column and UserName column are both Single line of text type column, the Workhours column is a Number type column.

25.JPG

Note: The TotalWorkHours column is a Number type column and the default value of it is 0.

 

I have made a test on my side and please take a try with following workaround:

  • Add a "When an item is created" trigger, specify Site Address and List Name.
  • Add a Variables-> "Initialize variable" action, Name set to OriginalHoursValue, Type set to Float and Value set to empty.
  • Add a "Get items" action, specify Site Address and List Name, Filter Query field set to following formula:
ProjectName eq 'ProjectName dynamic content of the trigger'

Note: The dynamic content is wrapped with single quotes within above formula.

 

  • Add a "Apply to each" action, input parameter set to output of "Get items" action.
  • Within "Apply to each" action, add a "Set variable" action, Name choose OriginalHoursValue variable, Value set to TotalWorkHours dynamic content of "Get items" action.

         Add a "Increment variable" action, Name choose OriginalHoursValue variable, Value set to WorkHours dynamic content of the trigger.

         Add a "Update item" action, specify Site Address and List Name, Id field set to ID dynamic content of "Get items" action, TotalWorkHours field set to OriginalHoursValue variable.

 

Note: The OriginalHoursValue variable is used to store original worked hours value within my secondary list.

 

Image reference:26.JPG

 

27.JPG

The flow works successfully as below:28.JPG

When I entry two records in my timesheet list as below:29.JPG

The secondary list calculates well as below:30.JPG

 

 

 

Best regards,

Kris

 

 

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SandraAkujobi
Post Partisan
Post Partisan

how would yoou apply this to individual projects and during different days. I s there a way to calculate a project weekly?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,491)