Showing results for 
Search instead for 
Did you mean: 

Group by for Sum, Average, CountRows and other aggregate functions

SQL Server and many other databases allow grouping of records for the purposes of calculating an aggregate value.   For example:


Select Count(Status) From Orders Group By Status.


The Power Apps formula language could accomplish the same thing by adding an additional optional argument to the aggregate functions.  The above could be expressed as:


CountRows( Orders, Status )


That returns a table with columns Status and CountRows


The same can be done for Sum and other aggregate functions, allowing Select Sum( Total ) From Orders Group By Status to be expressed as Sum( Orders, Total, Status ).


The GroupBy function can be used to do something similar but is not designed to be delegated to a database server.

Status: New