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 / trying to filter and s...
Power Apps
Answered

trying to filter and sort data in a Gallery by pressing a Button

(0) ShareShare
ReportReport
Posted on by 10

Hey, i am building a Ticket system. in my Ticket screen i got % buttons and a gallery:
the 5 Buttons should shows me Data from share point and Filtered by ticket Status.
Gallery should show me the Filtered Tickets when Pressing one of the buttons....
how ever i did code the buttons with Variables and set them to False by clicking they get set to True.
the problem is that the Gallery is not understanding my IF Function , any Idea ??

Gallery -->Items --> code:
If(
    varShowOpen = true,
    Filter(
        Ticket,
        "Open" in Status.Value
    ),
    If(
        varShowIn = true,
        Filter(
            Ticket,
            "In Progress" in Status.Value
        )
    ),
    If(
        varShowAwating = true,
        Filter(
            Ticket,
            "Awating Information" in Status.Value
            )
        ),
    If(
        varShowClosed = true,
        Filter(
            Ticket,
            "Closed" in Status.Value
            )
        )
)

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    Hi @MoFanar ,

    Try this

    Filter(
     Ticket,
     (varShowOpen && Status.Value = "Open") ||
     (varShowIn && Status.Value = "In Progress") ||
     (varShowAwating && Status.Value = "Awating Information") ||
     (varShowClosed && Status.Value = "Closed")
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @MoFanar 

    Change your buttons OnSelect to UpdateContext(varShow:Open}),  UpdateContext(varShow:In}), UpdateContext(varShow:Awaiting}), and UpdateContext(varShow:Closed})

    Make the Items property of your gallery:

     

    Switch(
     varShow,"Open", Filter(Ticket,"Open" in Status.Value).
     "In",Filter(Ticket,"In Progress" in Status.Value),
     "Awating",Filter(Ticket, "Awating Information" in Status.Value)
     "Closed", Filter(Ticket, "Closed" in Status.Value)
    )
    

    IMHO, the buttons are clunky, an alternative that I have used is even easier.  I would put a radio control on the screen with Items property ["Open","In Progress","Awaiting Information","Closed"]. 

    Make the Default property of the radio control Blank()

    and set the gallery Items property to

    Filter(Tickets, IsBlank(Radio1.Selected.Value)||Status.Value=Radio1.Selected.Value)

     

     

  • MoFanar Profile Picture
    10 on at

    Thank you Radio Idea fixed it ... but i have one more problem.. i want one more Radio button for All Tickets but i have no Data Value with the name All Tickets can you help me with that too ?

  • MoFanar Profile Picture
    10 on at

    Hi @Drrickryp ,
    Thank you Radio Idea fixed it
     ... but i have one more problem.. i want one more Radio button for All Tickets but i have no Data Value with the name All Tickets can you help me with that too ?

  • MoFanar Profile Picture
    10 on at

    Hi @WarrenBelz, it did not work, and cant tell why LOL ... can u maybe write me a full solution that works whit my idea ?
    idea is : 
    - 5 Buttons
    - a Screen that shows in a Gallery Specific Tickets type when Clicking a Button
    - Ticket types :
    Open Tickets
    In Progress
    Awating Information
    Closed
    - there is no Value with the name All Tickets but i want a button that shows All tickets
    Thx you ....

  • WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    @MoFanar ,

    It should have based on what you posted - it is simply a combination of the "pairs" you need - I was assuming Status was a single choice - if not you needed the in Filter, which is not Delegable.

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 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard