cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TJO
Resolver II
Resolver II

Collecting Average Values from tables

Hi Folks 

I'm trying to summarize data from a table and put it into a collection. I'm trying to explain my scenario with an example about car properties:

So I've got 2 connected tables, one with the columns 'Car brand' and 'Car model', and a 2nd big data table with the same 2 columns plus 'Lap times' (each car model may have many lap times).

 

My idea was to collect the first table (ClearCollect) and then do sth. like an AverageIf for each row on the 2nd table (i.e. if the first row of the collection is 'Audi' and 'A1', the average lap times of that model should be added (AddColumns) as a third column to the collection.

 

I guess the function ForAll could help, but my skills are not there yet.

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @TJO ,

You could use the GroupBy and Average functions with something like

AddColumns(
   GroupBy(
      YourSecondTableName,
      "Car brand",
      "Car model",
      "OtherData"
   ),
   "Averages",
   Average(
      OtherData,
      'Lap Times'
   )
)

This would produce three columns - 'Car Brand' , 'Car Model' and Averages (for each one)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Hi @TJO ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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