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 Apps
Answered

Gallery Sorting

(0) ShareShare
ReportReport
Posted on by 779

Hello Everyone,

 

I want to sort my gallery descending according to the concatenated expression below. If the concatenate DisplayNames are 5 or more than sort the gallery, so that the DisplayNames that is 5 or more is moved to the button and the less than 5 is on top of the gallery

Concat( Filter( SPList, Column1 = ThisItem.Column1 && Column2 = ThisItem.Column2 && Column3.Value = ThisItem.Column3.Value && Date = Text(ThisItem.Date,"dd-mmm-yyyy")), If( IsBlank(Column4) || Len(Trim(Column4)) = 0, "", Column4 & ";" ) )

 

Current Gallery Expression

Filter(SPList,If(varTabSelected2 = "All",true,Column3.Value=varTabSelected2))

 

I hope the information I provided is helpful.

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    Hi @Caleb62881177 

     

    Try this formula,

     

    SortByColumns(
    AddColumns(
    Filter(
    SPList,
    If(
    varTabSelected2 = "All",
    true,
    Column3.Value = varTabSelected2
    )
    ),
    "DisplayNameLength",
    Len(
    Concat(
    Filter(
    SPList,
    Column1 = ThisItem.Column1 && Column2 = ThisItem.Column2 && Column3.Value = ThisItem.Column3.Value && Date = Text(ThisItem.Date, "dd-mmm-yyyy")
    ),
    If(
    IsBlank(Column4) || Len(Trim(Column4)) = 0,
    "",
    Column4 & ";"
    )
    )
    )
    ),
    "DisplayNameLength",
    If(
    DisplayNameLength >= 5,
    SortOrder.Descending,
    SortOrder.Ascending
    )
    )

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • Caleb62881177 Profile Picture
    779 on at

    Hi @Rajkumar_404 , I get the error message saying "Name isn't valid. 'ThisItem' isn't recognized"

  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    Try this formula

     

    SortByColumns(
    Filter(SPList, If(varTabSelected2 = "All", true, Column3.Value = varTabSelected2)),
    "ConcatenatedColumn",
    If(
    Len(Trim(Column4)) >= 5,
    SortOrder.Descending,
    SortOrder.Ascending
    )
    )

  • Caleb62881177 Profile Picture
    779 on at

    @Rajkumar_404 - I am getting the error message "The function 'SortByColumn' has some invalid arguments"

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @Caleb62881177 thanks for the message but unfortunately I cannot understand what you're trying to do. Could you share a screenshot of your Gallery / or a sample image of:

     

    • Your data
    • The result you're expecting
  • Caleb62881177 Profile Picture
    779 on at

    Hi @Amik

    I have a SharePoint List with 4 columns

    Column1(Single Line Text), Column2(Single Line Text), Column3(Choice) and Column4(Single Line Text)

     

    In my gallery have: 

    Column1(DisplayNames)  Column2(DisplayNames) Column3(Categories) Column4(Concatenated DisplayNames)

     

    I want to filter the gallery according the how many concatenate DisplayNames (5 or more DisplayNames) are in column4 of the gallery

     

    Example:

     

    Column1         Column2          Column3            Column4

    DisplayName   DisplayName   Category2         0 Concatenated DisplayNames

    DisplayName   DisplayName   Category2         1 Concatenated DisplayNames

    DisplayName   DisplayName   Category2         2 Concatenated DisplayNames

    DisplayName   DisplayName   Category2         3 Concatenated DisplayNames

    DisplayName   DisplayName   Category2         5 Concatenated DisplayNames

    DisplayName   DisplayName   Category2         5 Concatenated DisplayNames

    DisplayName   DisplayName   Category2         6 Concatenated DisplayNames

     

    I hope This clears up any confusion.

     

    @Rajkumar_404 

     

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @Caleb62881177 - I still do not understand what you're trying to do.

     

    What does "how many concatenate DisplayNames" mean? 

     

    Does it mean you want to Filter the Gallery if 5 or more display names in Column4 exist in Column1?

     

    In the example below, only the first and fifth row should be given a "Yes" result, because each concatenated DisplayName in Column4:

     

    1. Exists as a value in Column1, and
    2. There are at least 5 display names in Column4 which exist in Column1

     

    Notice in the 2nd row, "Zach, Doherty" and "Wayne, John" in Column4 do not exist in Column1, thus the result is No.

     

    Amik_1-1708042533269.png

     

     

  • Caleb62881177 Profile Picture
    779 on at

    Hi @Amik ,What I mean by "many concatenated DisplayNames" is that the number of DisplayNames in Column4.

    In your Table example the two rows that has a Yes to move down to the bottom of the gallery and Single DisplayNames should move to the top of the gallery.

    Column 4 DisplayNames doesn't need to exist in Column 1.

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @Caleb62881177 - is this what you're trying to do?

     

    Sort(
     AddColumns(
     'Your Table',
     "CountNames",
     CountRows(
     Split(
     Column2,
     ";"// assumes your delimiter is a ";" symbol
     )
     ) >= 5
     ),
     CountNames,
     SortOrder.Ascending
    )
  • Caleb62881177 Profile Picture
    779 on at

    @Amik - I am getting an error with CountRows - "Expecting one of the following: Number, Decimal. Date, Time, DateTime"

     

    /Sort(AddColumns('Full Report',"CountNames",CountRows(Split(Judge,";")>=5),CountNames,SortOrder.Ascending)

     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard