2
votes

I want to group the "Incident Types" in the PowerApps collection shown below and sum the first column which is the "Incident Count". I have attempted to use the Group By function, but I was unable achieve the desired result. I simply want the total "Incident Count" for all "Incident Types".

Thanks

Collection

1

1 Answers

1
votes

This is an example of a grouping I have here with a count column:

ClearCollect(colGroupsRelation, 
    SortByColumns(
        AddColumns(
            GroupBy(colAppServersRelationAll, "ServerID","ServerGroup"),
            "AppCount", 
            CountRows(ServerGroup)
        ),
    "AppCount", Descending)
);

To Explain:

  • GroupBy(MyCollection, "Grouping On", "Name of the group")
  • AddColumns(MyCollection - 'note how I'm using the GroupBy', "Column Name", "Expression")
  • SortByColumns(MyCollection, "Column To Sort", "Direction to sort"),

You case might be like

AddColumns(
    GroupBy(YourDataSource, "Incident Types","IncidentTypesGroup"),
    "IncidentCountTotal", 
    Sum(IncidentTypesGroup,IncidentCount)
)