Hi @kzoltan,
Try the following code, where the counter is incremented when new records are added to the data collection:
ClearCollect(colSystemCounter, Blank());
Set(gblSystem, "A");
Collect(colSystemCounter,
{
System:gblSystem,
Counter:Max(Filter(colSystemCounter, System = gblSystem), Counter) + 1
}
);
Set(gblSystem, "B");
Collect(colSystemCounter,
{
System:gblSystem,
Counter:Max(Filter(colSystemCounter, System = gblSystem), Counter) + 1
}
);
Set(gblSystem, "C");
Collect(colSystemCounter,
{
System:gblSystem,
Counter:Max(Filter(colSystemCounter, System = gblSystem), Counter) + 1
}
);
Set(gblSystem, "A");
Collect(colSystemCounter,
{
System:gblSystem,
Counter:Max(Filter(colSystemCounter, System = gblSystem), Counter) + 1
}
);
Set(gblSystem, "B");
Collect(colSystemCounter,
{
System:gblSystem,
Counter:Max(Filter(colSystemCounter, System = gblSystem), Counter) + 1
}
);
Set(gblSystem, "A");
Collect(colSystemCounter,
{
System:gblSystem,
Counter:Max(Filter(colSystemCounter, System = gblSystem), Counter) + 1
}
);
ClearCollect(colSystemCounterSorted,
SortByColumns(colSystemCounter,
"System", SortOrder.Ascending,
"Counter", SortOrder.Ascending
)
);

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Follow me online.