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 / RowNumber with Group by
Power Apps
Unanswered

RowNumber with Group by

(0) ShareShare
ReportReport
Posted on by 19
Hi all!
I have a Sharepoint list:
RECRUITER Position CODE
Lisa P1
Homer P2
Bart P3
Homer P4
Lisa P5
Bart P6
Homer P7
 
RECRUITER is a person column.
 
I need to numerate the rows in a new column grouping by RECRUITER (person column) to get this result:
RECRUITER Position CODE MyPositions
Lisa P1 1
Homer P2 1
Bart P3 1
Lisa P4 2
Lisa P5 3
Bart P6 2
Homer P7 3
 
I'm facing two problems, person column to group by and how number the rows.
 
Anyone can help me ?
Categories:
I have the same question (0)
  • Suggested answer
    Garima_PowerPlatform Profile Picture
    170 on at
    Hi,
     
    You have 2 options 

    1. Grouping by Person Column

    SharePoint's Person or Group column stores metadata (like Display Name, Email, etc.), so you must use the unique identifier (e.g., email or display name) to group rows.

    • In Power Automate, use Email or DisplayName property.
    • In Power Apps, refer to RECRUITER.Email or RECRUITER.DisplayName.

    2. Numbering Rows

    • In Power Automate, use a counter to assign sequential numbers within the group.
    • In Power Apps, calculate the row number dynamically using CountIf().

    Option 1: Using Power Automate

    You can automate this process with Power Automate by creating a flow that numbers rows grouped by the RECRUITER column.

    1. Create a New Column
      In your SharePoint list, create a new column named Row Number (Type: Number). This column will hold the numbering values.

    2. Build the Flow

      • Open Power Automate and create an Automated Cloud Flow triggered when an item is created or modified.
      • Use the Get Items action to retrieve all rows from the SharePoint list.
      • Use the Filter Array action to filter items based on the RECRUITER column (use dynamic content to match).
      • Add an Apply to Each action to iterate through the filtered items and number them.
      • Inside the loop, use the Update Item action to update the Row Number column based on the current loop index.
    3. Configure the Grouping

      • Group rows in the Filter Array action using the RECRUITER column.
      • Use an expression in Power Automate to calculate the sequence number for each item.

    Option 2: Using Power Apps

    If you're building a Power Apps app that displays or interacts with your list, you can calculate and display row numbers dynamically.

    1. Retrieve Data from the SharePoint List
      Load the data from your SharePoint list into a collection using the ClearCollect function.

    ClearCollect(
       RecruiterData,
       AddColumns(
          SortByColumns('Your SharePoint List', "RECRUITER"),
          "RowNumber",
          CountIf(
             'Your SharePoint List',
             RECRUITER = ThisRecord.RECRUITER && ID <= ThisRecord.ID
          )
       )
    )
    Add a Gallery to Display Data
    Bind the gallery's data source to the RecruiterData collection.
    Use the RowNumber column to display the row numbering grouped by RECRUITER.

    Please click Does this answer your question 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 a Like.
     
  • douglas_filipe Profile Picture
    19 on at
    Use PA isn't a possibility.
     
    The second way not work, all rows get the same number.
  • AndrianaO Profile Picture
    213 Moderator on at
    Hi! Can you please explain in details how should the grouping work? You've provided an example, but I cannot see why first three lines with the different Recruiter names (Lisa, Homer, Bart) got the same MyPosition = 1.
  • WarrenBelz Profile Picture
    153,040 Most Valuable Professional on at
    I also have no idea where the numbers in the last column come from, but if you want totals by recruiter
    Ungroup(
       AddColumns(
          GroupBy(
             AddColumns(
                YourSPList,
                RecruiterGroup,
                Recruiter.DisplayName
             ),
             RecruiterGroup,
             Grouped
          ),
          MyPositions,
          CountRows(Grouped)
       ),
       Grouped
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
     
  • douglas_filipe Profile Picture
    19 on at
     
    I need create a sequence for each Recruiter, this image could be more clear:
    RECRUITER POSITION CODE MyPositions
    Lisa P1 1
    Lisa P4 2
    Lisa P5 3
    Homer P2 1
    Homer P7 2
    Bart P3 1
    Bart P6 2
    Bart P8 3
     
     
  • Suggested answer
    AndrianaO Profile Picture
    213 Moderator on at
    @douglas_filipe thanks for the clarification! I have a formula for you, it hopefully should do the trick
     
    ClearCollect(
        finalCollection,
        Ungroup(
            ForAll(
                GroupBy(
                    AddColumns(
                        'Test List',
                        RecruiterGroup,
                        'test person'.DisplayName
                    ),
                    RecruiterGroup,
                    Grouped
                ) As tableGrouped,
                ForAll(
                    Sequence(CountRows(tableGrouped.Grouped)),
                    Patch(
                        Last(
                            FirstN(
                                tableGrouped.Grouped,
                                Value
                            )
                        ),
                        {MyPosition: Value}
                    )
                )
            ),
            Value
        )
    )
     
    Where 'Test list' is a connected SharePoint list and 'test person' is a person field in that list. Let me know if this works! 

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard