I have a TableA
Name Quantity
Ben 6
Andy 3
Ben 4
John 6
George 2
Andy 5
I use ClearCollect ( Col_stats, RenameColumns( Distinct (TableA, Name),"Result","Name") to create Col_stats.
I want Col_Stats to show the following
Name Count Sum Avg
Andy 2 8 4
Ben 2 10 5
John 1 6 6
George 1 2 2
How would I do this?
Now I need to maybe use the ForAll function that will evaluate across table A, using the distinct records of Table B.
I know I need to use AddColumns to create a new column in the collection. Having trouble wrapping my head around how to structure this.
I am adding to this older thread as I have used the solution provided by @CMee in order for me to create a collection that calculates my total stock on hand per BatchCode.
So I have in a gallery a column for BatchCode and Tsum
ClearCollect(Col_stats,
AddColumns(GroupBy('Stock Receivals',"BatchCode","Total"),
"TSum",Sum(Total.SOH,SOH)
)
)
What I don't know how to do, is bring in additional fields from my SP List so that in the gallery, I can identify the product by name and barcode, not just BatchCode. How would I include these fields?
Thanks
Thanks @CMee , this worked for me. Had to remove a column that contained records from the view, but is displaying the correct information.
I've never used AddColumns before, but anyway, see if this works:
ClearCollect(Col_stats, AddColumns(GroupBy(TableA,"Name","NameGroup"), "TSum",Sum(NameGroup.Quantity,Quantity), "TCount",CountA(NameGroup.Quantity), "TAverage",Average(NameGroup.Quantity,Quantity) ) )
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2