8.9 Judging belongingness of sets when order is ignored

 

Here below is a monthly sales ranking table for the first quarter:

imagepng

Find out the month that contains the top 3 products by total sales in the first quarter:

A
1 =E(‘A1:D16’)
2 =A1.groups(ProductName;sum(Sales):Sales).sort(Sales:-1).(ProductName)(to(3))
3 return A1.group@o(Month).select(~.(ProductName).pos(A2)!=null).id(Month)

A1: Convert the passed-in data to a two-dimensional table sequence.
A2: Calculate the top 3 products by total sales in the first quarter.
A3: Find out the month that contains the top 3 products in the first quarter through the operation for judgement of belongingness of sets.

Result: Jan, Mar


https://c.scudata.com/article/1651916536524
https://c.scudata.com/article/1655428808127
https://c.scudata.com/article/1655564978878