How to add and average duplicate row values

Hello Everyone! 

I'm stumped, the below table represents employees (ID Column) and their corresponding production totals. I am wanting to create an expression or workflow where I can sum and average the duplicate ID's corresponding hours. Im stuck at the start line and dont even know where or how to begin. 

 

CrewIDNameBPHBoxes PickHoursDate
Crew: GS582287ROSAS CASTILLO JOSE6.9230.434/30/2022
Crew: GS582287ROSAS CASTILLO JOSE11.51332.874/30/2022
Crew: GS593675FILOMON OROPEZA VICTOR6.9230.434/30/2022
Crew: GS593675FILOMON OROPEZA VICTOR13.95402.874/30/2022
Crew: GS597248JIMENEZ RUIZ FERMIN RICARDO4.6220.434/30/2022

 I would like to end up with each ID's hourly sum but there are various rows w/ the same ID.

 

Any help!

Solved Solved
0 2 210
1 ACCEPTED SOLUTION

If you want to avoid duplicates (no duplicate ID + Date rows) in the first place then this article will help.

https://www.googlecloudcommunity.com/gc/Tips-Tricks/How-to-Prevent-Duplicate-Records/m-p/401389#M594...

If employees entering multiple rows on a given day is allowed then you can get the average by

AVERAGE(
 SELECT(
  tableName[Hours],
  AND(
   [ID] = [_THISROW].[EmpID]
   [Date] = [_THISROW].[DateToCalculate]
  )
)

I am assuming that you have a table that stores the sum/average hours of workers each day consisting these cols.

[rowID], [DateToCalculate], [EmpID], [Daily SUM],  [Daily Average]

Just replace AVERAGE with SUM for [Daily SUM]

View solution in original post

2 REPLIES 2

If you want to avoid duplicates (no duplicate ID + Date rows) in the first place then this article will help.

https://www.googlecloudcommunity.com/gc/Tips-Tricks/How-to-Prevent-Duplicate-Records/m-p/401389#M594...

If employees entering multiple rows on a given day is allowed then you can get the average by

AVERAGE(
 SELECT(
  tableName[Hours],
  AND(
   [ID] = [_THISROW].[EmpID]
   [Date] = [_THISROW].[DateToCalculate]
  )
)

I am assuming that you have a table that stores the sum/average hours of workers each day consisting these cols.

[rowID], [DateToCalculate], [EmpID], [Daily SUM],  [Daily Average]

Just replace AVERAGE with SUM for [Daily SUM]

Thank You!

Top Labels in this Space