cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ciprianpopovici
Helper III
Helper III

Sort gallery by label value inside

Hello

I add a gallery with Items, names of Assigned People (it's a list with several names). In this gallery i add a label that calculate number of tickets per every people in this gallery. The formula of the label is based on a collection from another sharepoint list of tickets.

CountIf(col_AllTickets,ThisItem.Responsabil.DisplayName in Responsabil_Ticket'.DisplayName);

 

The Gallery display nice and correct the information but i want to sort the gallery based on largest number of tickets ,.

How can i achieve this sort by value of this label , without circular referencing error.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Krishna_R
Responsive Resident
Responsive Resident

Hi @ciprianpopovici ,

 

AddColumns can do the trick for you here, Add the below into your gallery items property:

SortByColumns(
  AddColumns(
     GalleryDataSource As X,
     "ticketsCount",
     CountIf(col_AllTickets,X.Responsabil.DisplayName in Responsabil_Ticket'.DisplayName)
  ),
ticketsCount,
Descending
)

View solution in original post

2 REPLIES 2
Krishna_R
Responsive Resident
Responsive Resident

Hi @ciprianpopovici ,

 

AddColumns can do the trick for you here, Add the below into your gallery items property:

SortByColumns(
  AddColumns(
     GalleryDataSource As X,
     "ticketsCount",
     CountIf(col_AllTickets,X.Responsabil.DisplayName in Responsabil_Ticket'.DisplayName)
  ),
ticketsCount,
Descending
)
ciprianpopovici
Helper III
Helper III

Thank you, it's working but can you try to explain what is doing As X function in this context. It will be better if  understand...

Thanks again.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,550)