8.7 Judge belongingness of sets when order is considered

 

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 (same ranking order is required):

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@c(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: When the pos@c() judges the belongingness of sets, the order of members should be the same.

Result: Jan 


esProc Desktop and Excel Processing
8.6 Judge equality of sets when order is considered
8.8 Judge equality of sets when order is ignored