sumif — aggregate function to return the sum of rows that match the query's predicate.
The sum() function returns the sum of the values for which the specified numeric column is not null and for which the predicate evaluates to true. The predicate expression can be any valid expression on any column in a table, is not restricted to values from the specified column.
This example shows how to use dynamic aggregation using this function. In the Hello LiveView sample, create a query that finds the sum of large value sales per item type for non-null transactions in the ItemSales table. Follow these steps:
In LiveView Desktop connected to a server running the Hello LiveView sample, select the ItemsSales table from the Tables pane of the LiveView Tables view.
In the Select field, enter:
Item, sumif (transactionID, lastSoldPrice > 75) as TotalBigSales
In the Query field, enter the following:
group by Item
The query results open in a grid view. LiveView Server recalculates the TotalBigSales values whenever the rows returned by the query predicate change.
This LiveView aggregate function is based on the sumif aggregate function in the StreamBase expression language.