I prefer to not use Collections for the source of a Gallery unless I have to. If your list runs over 500 items (with sundry caveats), you're going to have to run your Collect() statement a number of times. Not to mention you're then working with a copy of your data, not the actual underlying table.
You could set up the Gallery to have an Items property built using an If() statement...
If (
Condition1, Filter(....),
Condition2, Filter(....),
Condition3, yourUnfilteredSource
)
Then use your buttons' OnSelect property to establish whatever that condition you want to use:
...a string that is one of 3 values for your three cases
...a set of 3 boolean values, where each button only sets one to be true and the rest to be false
And feed that condition test into the If() statement:
If (
yourString = "Faults", Filter(.....),
yourString = "Resolved", Filter(.....),
yourString = "All", yourUnfilteredSource
)
Now, to address your Sorting requirement, if you always want the Gallery to be sorted, you have to wrap the statement producing the table of Items in a SortByColumns() statement. In @v-yamao-msft 's suggestion, that would be:
SortByColumns(newList11, "Created", Descending)
...But you can wrap my If() statement in the same SortByColumns() to arrive at the same place:
SortByColumns(
If (
yourString = "Faults", Filter(.....),
yourString = "Resolved", Filter(.....),
yourString = "All", yourUnfilteredSource
),
"Created",
Descending
)
On the other hand, if you wanted to turn the sorting on/off, then you could either have another If() statement wrapping the whole statement, with one branch incorporating the SortByColumns() verbiage and other branch no, or you could embed an If() statement into the field selection for the SortByColumns() statement, provided you could supply what field should provide the default sorting.
For example, imagine you had a field in your datasource called "Assigned", and you added a checkbox to your screen that was labeled "Sort by Assigned" and named chkSortByAssigned. Typically you wanted to sort on Created, but when you checked the box, you wanted to sort on Assigned. That Items statement would look like:
SortByColumns(
If (
yourString = "Faults", Filter(.....),
yourString = "Resolved", Filter(.....),
yourString = "All", yourUnfilteredSource
),
If ( chkSortByAssigned,
"Assigned",
"Created"
)
Descending
)
Some people might find that more dense to parse out what is going on, but I find it more helpful to have all of my code language right there in the one place, especially if it gets me the added benefits I listed, above.