6.11 Use group’s aggregation value when filtering
We have an aggregation table for the sales of grouped products:
Now we want to find out the product whose sales is greater than the average in its group:
=spl("=E(?1).group(CategoryName).(a=~.avg(ProductSales),~.select(ProductSales>a)).conj()",A1:C78)
To solve this problem, we can first calculate group’s average sales and assign it to the temporary variable a, and then use ProductSales>a as the filter condition to filter the group.
esProc Desktop and Excel Processing
6.10 Filter by group’s aggregation value
6.12 Filter by maximum or minimum value within a group (find out one for each group)
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_Desktop/
SPL Learning Material 👉 https://c.scudata.com
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProcDesktop
Linkedin Group 👉 https://www.linkedin.com/groups/14419406/