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 / Need help with filtering
Power Apps
Answered

Need help with filtering

(0) ShareShare
ReportReport
Posted on by 14

Hi guys,

 

I am new to Power Apps and busy developing an application for a client.

 

I am stuck with a filter not working:

XmThRiR

When "Any" is selected in the Document Controller Name, it does not display data but works perfectly fine when you select a DC.

 

Here is my code for it:

 

 

 

Search(
 Filter(
 'DummyData',
 If(
 varCurrentTab = "All Projects",
 true,
 varCurrentTab = "Active",
 Status = "Active",
 varCurrentTab = "On Hold",
 Status = "On Hold",
 varCurrentTab = "Complete",
 Status = "Complete",
 varCurrentTab = "Terminated",
 Status = "Terminated",
 varCurrentTab = "Funding Request",
 Status = "Funding Request",
 varCurrentTab = "Pipeline",
 Status = "Pipeline",
 varCurrentTab = "Unknown",
 Status = "Unknown"
 ),
 DC = dc_dropdown_1.Selected.Result
 ),
 search.Text,
 "Name",
 "Site",
 "Code"
)

 

 

 

 

How can I fix this problem? Any assistance will be much appreciated.

 

Thanks,
Andrew

Categories:
I have the same question (0)
  • zmorek Profile Picture
    3,272 on at

    Can you try:

     

    Search(
     Filter(
     'DummyData',
     (varCurrentTab = Status || If(varCurrentTab = "All",true)),
     DC = dc_dropdown_1.Selected.Result
     ),
     search.Text,
     "Name",
     "Site",
     "Code"
    )
  • iiSmitty Profile Picture
    14 on at

    Thanks for the reply, close but no cigar!

     

    I tried running the code but sadly it is just outputting nothing.

     

    Tweaked the code a bit but am still stuck on the same problem, doesn't show all data when 'Any' is selected for DC:

     

     

     

    Search(
     Filter(
     DummyData,
     varCurrentTab = Status || If(varCurrentTab = "All Projects",true) || If(dc_dropdown_1.Selected.Result = "Any",true),
     DC = dc_dropdown_1.Selected.Result
     ),
     search_1.Text,
     "Name",
     "Site",
     "Code"
    )

     

     

    For what it is worth, I made a collection for the DCs on the screen (OnVisible property):

     

    ClearCollect(
     collectDC,
     {Result: "Any"}
    );
    Collect(
     collectDC,
     Distinct(
     DummyData,
     DC
     )
    );
    Set(
     varCurrentTab,
     "All Projects"
    );

     

    Not sure if this is perhaps where the error can be or contributed from?

  • iiSmitty Profile Picture
    14 on at

    Managed to get the code working. Unfortunately, the date does not filter at all.

     

     

     

    Search(
    If(
    // NO FILTERING
    dc_dropdown.Selected.Result = "Any" And varCurrentTab = "All Projects", DummyData,
    // FILTER FOR TABBING
    dc_dropdown.Selected.Result = "Any" And varCurrentTab <> "All Projects",
    Filter(DummyData, varCurrentTab = Status),
    // FILTER FOR DC
    dc_dropdown.Selected.Result <> "Any" And varCurrentTab = "All Projects",
    Filter(DummyData, DC = dc_dropdown.Selected.Result),
    // FILTER FOR TABBING AND DC
    dc_dropdown.Selected.Result <> "Any" And varCurrentTab <> "All Projects",
    Filter(DummyData, DC = dc_dropdown.Selected.Result And varCurrentTab = Status),
    // FILTER DATE
    Filter(DummyData,'Start' >= dte_StartDate,'End' <= dte_EndDate)
    ),
    search.Text,
     "Name",
     "Site",
     "Code"
    )

     

     

     

    The confusing part for me is that I can see it has the correct result but not displaying it?
    Usmt8z4

  • Verified answer
    iiSmitty Profile Picture
    14 on at

    So I figured out the problem. The date filter was in the else statement and of course the if statement was true so was never executed.

     

    Here is the final code that works flawlessly:

     

    Search(
    If(
    // DATE FILTER
    dc_dropdown.Selected.Result = "Any" And varCurrentTab = "All Projects",
    Filter(DummyData, Start >= dte_StartDate, End <= dte_EndDate),
    // NO FILTERING
    dc_dropdown.Selected.Result = "Any" And varCurrentTab = "All Projects", DummyData,
    // FILTER FOR TABBING
    dc_dropdown.Selected.Result = "Any" And varCurrentTab <> "All Projects",
    Filter(DummyData, varCurrentTab = Status, Start >= dte_StartDate, End <= dte_EndDate),
    // FILTER FOR DC
    dc_dropdown.Selected.Result <> "Any" And varCurrentTab = "All Projects",
    Filter(DummyData, DC = dc_dropdown.Selected.Result, Start >= dte_StartDate, End <= dte_EndDate),
    // FILTER FOR TABBING AND DC
    dc_dropdown.Selected.Result <> "Any" And varCurrentTab <> "All Projects",
    Filter(DummyData, DC = dc_dropdown.Selected.Result And varCurrentTab = Status, Start >= dte_StartDate, End <= dte_EndDate)
    ),
    search.Text,
     "Name",
     "Site",
     "Code"
    )

     

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
WarrenBelz Profile Picture

WarrenBelz 421 Most Valuable Professional

#2
11manish Profile Picture

11manish 153 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 116 Super User 2026 Season 2

Last 30 days Overall leaderboard