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

How can you calculate the Average in a DataTable Column?

I have a calculated column in a DataTable. DataTable1, the calculated column name is Trunc.

 

How do I calculate the average of Trunc?

 

Thanks,

Jim

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

Hi @GandT 

You may need to replace DataTable1 in your formula with the actual Items property of the datatable itself.  I found by experimentation, that if you use a gallery instead of a datatable, that your formula works but it requires Gallery1.AllItems, something that is not available in a datatable.  In the screenshot, the average works for the gallery but not the datatable.  However, if I replace DataTable2 in the formula with 

Average(
        Filter(
               sales, Country=Dropdown2.Selected.Result),'Units Sold'
        )
)

, then it works fine.  FYI, you can design a gallery to look identical to a datatable and it is a much more flexible control. 

_1.png

View solution in original post

5 REPLIES 5
rubin_boer
Super User
Super User

Hi @GandT Average(DataTable1,Trunc) this will be the average of the whole Trunc column

 

hope it helps

 
GandT
Frequent Visitor

Thanks I tried that again just now and I get this..

GandT_0-1613748544186.png

 

rubin_boer
Super User
Super User

hi @GandT  seems like the type of data is text, try Average(DataTable1, Value(Trunc))

 
Drrickryp
Super User
Super User

Hi @GandT 

You may need to replace DataTable1 in your formula with the actual Items property of the datatable itself.  I found by experimentation, that if you use a gallery instead of a datatable, that your formula works but it requires Gallery1.AllItems, something that is not available in a datatable.  In the screenshot, the average works for the gallery but not the datatable.  However, if I replace DataTable2 in the formula with 

Average(
        Filter(
               sales, Country=Dropdown2.Selected.Result),'Units Sold'
        )
)

, then it works fine.  FYI, you can design a gallery to look identical to a datatable and it is a much more flexible control. 

_1.png

View solution in original post

GandT
Frequent Visitor

Using your suggestion, I did finally get it to work. The data was in a Datatable, the interim calculations were in a Gallery and the Average was in a TextInput box.  Convoluted, but it worked.  Thanks again.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, 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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,042)