Hi @Splotchy0541 ,
The issue you're facing with sorting appears to be due to the sorting function treating your numbers as text rather than numerical values. In Power Apps, when you sort a text field that contains numbers, it will sort them alphabetically, which is why "100" comes after "1" instead of before "2".
Here is a quick way to resolve this:
You need to ensure that the sorting is based on a numeric field. Since your 'OPEN DAYS' column is a calculated field that results in text (including " Dia(s)" at the end), you'll want to sort based on the raw numeric value of the 'OPEN DAYS' column before it's converted to text with the added " Dia(s)".
Assuming that the 'OPEN DAYS' column contains the raw number without text, your sorting formula should look like this:
Sort(COMLIS, Value('OPEN DAYS'), Descending)
If 'OPEN DAYS' is not a separate column, create a new column that stores the numeric value of the days, then sort using this new column.
In case you cannot add a new column to your source data, you might need to create a collection or a temporary table within Power Apps that strips the text and retains only the numeric part of your 'OPEN DAYS' field, which you can then sort numerically.
The formula for creating such a collection would look something like this:
ClearCollect(
CollectionSorted,
AddColumns(
COMLIS,
"NumericOpenDays", Value(Text(ThisItem.'OPEN DAYS'))
)
);
And then you sort CollectionSorted by NumericOpenDays:
Sort(CollectionSorted, NumericOpenDays, Descending)
This will create a collection with a numeric representation of your 'OPEN DAYS' which can be sorted appropriately. Remember to replace 'OPEN DAYS' with the actual internal name of your column if it's different.
Best Regards,
Hassan Raza