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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Distinct Filter and So...
Power Apps
Answered

Distinct Filter and Sort on Gallery

(0) ShareShare
ReportReport
Posted on by 112

Hey all,

 

I am looking to make a Tablet view of the ticket system that I am currently working on at the moment.Capture.PNG

 

As you can see with the image, I have buttons and I have a gallery below the buttons. I have two goals to be accomplished with this.

  1. What I am trying to do is have a gallery or buttons, which ever is easier, to display the status of the tickets. Using the Gallery, do I use:
    distinct(filter(datasource, status))
     

    The buttons are an easy fix since you can just use UpdateCOntext and use a global variable, but they dont look pleasing to the eye vs the gallery. 

  2. The other thing I am trying to get to work is with this selection of the status, in another gallery, I will show the tickets with said selected status. EX I select "in progress tickets", all the in progress tickes will show and vice versa. TicketView is the variable that sets the filter on the gallery.
  3. Filter(Tickets_1,If(TicketView = "Open", show all open tickets, If(TicketView = "In Progress", show all in progress tickets, If(...........))))

Any help would be appriciated. Thank you in advance!

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    1. To have gallery with distinct ticket statuses use this for Galery.Item 

     

    Distinct(DataSource,status)

    To show how many tickets have the specific status use this formula for one of the gallery items

    CountRows(Filter(DataSource, status = ThisItem.Result))

    Here is how something similar would look like for Airport codes:

    13.png

     

    Change the code of the arrow OnSelect property to:

    Navigate(Screen2,None,{TktStatus:ThisItem.Result})

    On Screen2 add gallery and change Gallery2.Item to this:

    Filter(DataSource,status=TktStatus)

    And you will get something like this:

    14.png

  • Daemagor Profile Picture
    112 on at

    @Anonymous,

     

    Thank you for the response. Inside the ticket gallery,  

    CountRows(Filter(Tickets_1, Status = ThisItem.Result))

     The equals is spitting out an error, Invalid argument type. I have tried Status.Value and Status.Item, while Status.Value will spit out on Value: Suggestion: Part if this filter formula cannot be evaluated remotly due to service limitations..... I also have changed the equals sign to in and the .Result spits out: Invalid arg type. Cannont use record values in  this context. But I have one more change to this and thats when I do this: 

    CountRows(Filter(Tickets_1, Status.Value in ThisItem.Result.Value))

    That has an output of 3, which I do not want. I am trying to get: Open Ticket, In Progress Ticket, Waiting Ticket as the output.

  • Community Power Platform Member Profile Picture
    on at

    Couldn't you just do CountRows(Filters(Tickets_1, Status=ThisItem.Status)) or am I missing what you are trying to accomplish here?

  • Daemagor Profile Picture
    112 on at

    @Anonymous,

     

    I updated the post above you, take a look at what I recently added to the post. But theres a problem with CountRows(Filters(Tickets_1, Status=ThisItem.Status)). Status is an invalid name at that point.

  • Community Power Platform Member Profile Picture
    on at

    Hi @Daemagor

     

    Do you want the name of status or number of how many tickets there are with specific status?

     

    If you want the name just change label.Text to

    ThisItem.Result

    If you want the number of tickets with specific status change label.Text to

    CountRows(Filter(Tickets_1, Status = ThisItem.Result))

     ThisItem.Result only works inside Gallery Card so make sure your label is inside the gallery card otherwise you get an error.

     

    Pictures with what you have would help to solve it faster.

     

    Here is what I mean by inside gallery or outside:

    1.png

  • Community Power Platform Member Profile Picture
    on at

    Well the CountRows function is literally counting how many of said condition you have so that is going to be a number. So if you aren't expecting a number that isn't going to work for you.

  • Daemagor Profile Picture
    112 on at

    @Anonymous & @Anonymous,

     

    I want the name not the number, sorry for the confusion. But ThisItem.Result on result is spiting and error that it expects a Text value but the rule produces incompatible record values.

     

    This is inside the gallery too

  • Community Power Platform Member Profile Picture
    on at

    Your Gallery.Item is this?

    Distinct(Tickets_1, Status)

    If yes

     

    ThisItem.Result will be the name of the Status

     

    For it to work you have to put it inside Gallery card not outside, if you put outside you get invalid argument type.

     

    Again posting a picture of what you have setup would make it easier to solve

  • Daemagor Profile Picture
    112 on at

    Capture.PNGCapture.PNG

     

  • Community Power Platform Member Profile Picture
    on at

    What is the type of Status column in your datasource?

     

    Is it a lookup field?

    If yes try to do this

    ThisItem.Result.Value

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard