8.6 Judge equality of sets when order is considered

 

Here below is a monthly sales ranking table for the first half of the year:

imagepng

Find out the month whose products ranking by sales is the same with the products ranking by total sales in the first half of the year:

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

A1: Convert the passed-in data to a two-dimensional table sequence.
A2: Calculate the products ranking by total sales in the first half of the year.
A3: Find out the month whose products ranking by sales is the same with the products ranking by total sales in the first half of the year through the operation for judgement of the equality of sets.

Result: May 


esProc Desktop and Excel Processing
8.5 Intersection, union and difference in the case of row-based data - multiple sets
8.7 Judge belongingness of sets when order is considered