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 / Using GroupBy and Left...
Power Apps
Unanswered

Using GroupBy and Left functions in PowerApps

(0) ShareShare
ReportReport
Posted on by 38

I have a SharePoint List with the Title field populated with the following data format:

 

24-1000.01

24-1000.02

24-1001.01

24-1002.01

24-1002.02

24-1002.03

 

The first thing I am trying to do with this data is use the GroupBy and Left functions to look at the 7 leftmost characters, then display a list of unique values in a gallery. So, the results would be:

 

24-1000

24-1001

24-1002

 

 

Categories:
  • BhaskarDhone Profile Picture
    1,398 Super User 2026 Season 1 on at

    Try this on your gallery.

    Distinct(DataSource, Left(Title, 7))
  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    @metalproswi - one example:

     

    DropColumns(
     GroupBy(
     AddColumns(
     'Your Table,
     "metalproswi_custom_column",
     Left(
     Title,
     7
     )
     ),
     "metalproswi_custom_column",
     "GroupedItems"
     ),
     "GroupedItems"
    )

     

    Please note the GroupBy function is not delegable.

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @metalproswi ,

     

    Please try this.

    Distinct(Left(ListName.Title,7),Value)

     

    Best regards,

    Rimmon

  • metalproswi Profile Picture
    38 on at

    I tried the 'Distinct' and 'DropColumns' suggestions, however non worked in my gallery. I will try recreating my gallery from a basic app to rule out any other variables.

  • metalproswi Profile Picture
    38 on at

    metalproswi_0-1712583121670.png

    I can't get past a logic error after entering the data source.

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

    @metalproswi:

     

    "metalproswi_custom_column" is a random name I gave to the newly added column. You can use any name you want.

     

    DropColumns(
     GroupBy(
     AddColumns(
     '2024 MP Lot Records',
     "title_custom",
     Left(
     Title,
     7
     )
     ),
     "title_custom",
     "GroupedItems"
     ),
     "GroupedItems"
    )

     

    Further reading on the AddColumns function:

     

    https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-table-shaping

     

  • metalproswi Profile Picture
    38 on at

    I am using an empty column in my SharePoint List, but I can't get past the generic 'invalid arguments' message. I will read up more on the AddColumns function.

     

    metalproswi_0-1712662446574.png

     

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

    @metalproswi - please could you use the code I provided. At present you're trying to do something else (using the Distinct function is not part of my suggestion).

  • metalproswi Profile Picture
    38 on at

    Sorry about that. I was trying several things. The formula is no longer erroring; however the data is not displaying correctly. 

     

    My data set is like this:

    24-1000.01

    24-1000.02

    24-1001.01

    24-1002.01

    24-1002.02

    24-1002.03

     

    And I would like to display it like this:

    24-1000

         24-1000.01

         24-1000.02

     

    24-1001

         24-1001.01

     

    24-1002

         24-1002.01

         24-1002.02

         24-1002.03

     

    This is the what the current output is displaying like:

    metalproswi_0-1712676458761.png

     

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

    @metalproswi - that is a completely different format than the one you asked for in your first post. You're going to need to create a Nested Gallery for that.

     

    https://www.youtube.com/watch?v=25_bdexevGk 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard