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 / Filter not working fro...
Power Apps
Answered

Filter not working from collection. Only working for hard coded values

(0) ShareShare
ReportReport
Posted on by 6,048 Super User 2024 Season 1

q3.jpgq4.jpg

 

Code on Gallery:

 

Filter(
 BudgetTracker,
 Year.Value = drpYear_7.Selected.Value,
 Company.Value in ComboBox1_11.SelectedItems || ComboBox1_11.Selected.Value = "All",
 OfficeLocation.Value = drpOffice_6.Selected.Value || drpOffice_6.Selected.Value = "All",
 Month.Value in ComboBox1_3.SelectedItems || ComboBox1_3.Selected.Value = "All",
 Category.Value in cmbExpCat.SelectedItems || cmbExpCat.Selected.Value = "All"
 ) 

 Code to make collection:

 

ClearCollect(
 colExpenseCategoryChoices,
 Choices(Expenses.Category)
);
Collect(
 colExpenseCategoryChoices,
 {Value: "All"}
)

 When i use collection filter is not working. When i use hardcoded values it works. Also When i use Selected.Value Instead of SelectedItems it works for collection too. 

Categories:
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    a7.jpg

     

    Ok. This worked. But i don't know why. collection itself is table. Why do i need to write value

  • Verified answer
    WarrenBelz Profile Picture
    156,754 Most Valuable Professional on at

    Hi @zmansuri ,

    You can probably tidy up the code with some distinct bracketing as below

    Filter(
     BudgetTracker,
     Year.Value = drpYear_7.Selected.Value &&
     (
     ComboBox1_11.Selected.Value = "All" ||
     Company.Value in ComboBox1_11.SelectedItems
     ) && 
     (
     drpOffice_6.Selected.Value = "All" ||
     OfficeLocation.Value = drpOffice_6.Selected.Value
     ) &&
     (
     ComboBox1_3.Selected.Value = "All" ||
    	 Month.Value in ComboBox1_3.SelectedItems
     ) &&
     (
     cmbExpCat.Selected.Value = "All" ||
     Category.Value in cmbExpCat.SelectedItems
     )
    ) 

    and

    Collect(
     colExpenseCategoryChoices,
     {Value: "All"},
     Choices(Expenses.Category)
    );
    

    but to answer your question, you still may need to specify the field you want to display

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard