'Why can I not Distinct Gallery items from a SharePoint List in PowerApps

So I consider myself pretty experienced in the PowerApps area however I have faced an issue I have never seen before and cannot find a work around.

So I have a gallery getting its data fed through a SharePoint list full of names (some repeating). I am trying to distinctly return the names and display them on a gallery only once (hence the distinct). However as soon as I wrap my filter by columns with Distinct() I get an error displaying:

How can I fix this as I have no idea why adding the Distinct is causing a problem with the default when I'm sure in the past has not been an issue. Can anyone enlighten me?

My Gallery items are:

Defaults('Archive')

And my items are:

Distinct(SortByColumns(Filter('ER Archive', StartsWith('Staff Name', trackSearchBar.Text)), "StaffName"), 'Staff Name')

And its returning information on the gallery however its giving me the error.



Solution 1:[1]

Defaults function in Power Apps

You are using two different data sources = Archive in Defaults('Archive')

and

ERArchive in Distinct(SortByColumns(Filter('ER Archive', StartsWith('Staff Name', trackSearchBar.Text)), "StaffName"), 'Staff Name')

Please follow the defaults documentation link above

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kuro Neko