Hi,
One way to what you want is creating a collection with all the codes and then count how many time each one appear in this collection, like this:
Clear(colAux); // the collection that will store all the codes
ForAll(
Filter(
SharePointList, // the name of your ShP
Item = "A" // The filter to select the Item
),
Collect(colAux,{Code:Code1}); // adding code1 to the collection
Collect(colAux,{Code:Code2}); // adding code2 to the collection
Collect(colAux,{Code:Code3}); // adding code3 to the collection
);
ClearCollect(
colResult, // the result collection
Sort(
AddColumns(
GroupBy( // this will group the same codes
colAux,
"Code",
"Group"
),
"Count",
CountRows(Group) // and this will count how many time each code appear
),
Count,
SortOrder.Descending
)
)
I hope it helps 🙂