web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / ClearCollect - Add "Al...
Power Apps
Answered

ClearCollect - Add "All" results

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone,

 

I've added a dropdown to filter my gallery. Therefore, I created a collection with diyplays all the distinct results in my table. Now I also want to have one items which says "All" and shows every result in my list. I've tried the following:

 

 

ClearCollect(collectMonths; {Result: "All"});
Collect(collectMonths; Distinct(Statement; Month))

 

 

The Collect part is working fine but the ClearCollect function gives out an error saying that the function has invalid arguments. 

Thanks!

Categories:
  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @Anonymous 

    I think you need to use , instead of ;

    ClearCollect(collectMonths, {Result: "All"});
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Mira_Ghaly 

     

    I was using the German version of PowerApps so that's not the issue.

    I tried using both formulas separately and both of them work fine. Only together it doesn't work. Any idea on how to solve that? It seems like this ; after the first formula is the issue.

    I've changed to the American version of PowerApps now, so my code looks like this:

    ClearCollect(collectMonths, {Result: "All"});
    Collect(collectMonths, Distinct(Statement, Month))

     

  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @Anonymous 

    Try

    ClearCollect(collectMonths, {Result: "All"});
    Collect(collectMonths, Distinct('Statement', Month))
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Mira_Ghaly 

     

    Makes no difference unfortunately.

  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @Anonymous 

    So are you sure of your table and column name for the Distinct ?

    Can you share the error message?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Mira_Ghaly 

    Yes, as I mentioned above. Both formulas individually work. Just together it gives out an error.

    For both functions the error is that they have some invalid arguments and in the collect function it shows another error that it is an incompatible type to put into a collection.

  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @Anonymous 

    From the error message it looks like you are appending different types so something like string and integer.

     

     

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    If you are trying to add an "All" to your list, you can do this without a collection (as it is a bit of unneeded overhead for your app, and just another thing to keep track of, and a pain to maintain).

    You might be interested in my video on that subject.

     

    As for the formula, you need to change the type of your Month (assuming it is numeric):

    ClearCollect(collectMonths, {Result: "All"}, Distinct(Statement, Text(Month)))

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard