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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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