Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Sorting and grouping data results in Power Apps

(0) ShareShare
ReportReport
Posted on by

I have an Excel file that has a list of sales account leads. The unique field in the data is the Full Name which is the contact manes at each of the companies. There are multiple entries for a specific Account Name - Company as I have been given multiple lead-contacts per company to reach out to. I love the new "Ideas" in Power Apps where they attempt to help users build querries but It is in it's infancy. Here is what I am trying to do:

Sort(Distinct('Table1', 'FullName'), Result, Ascending) group by AccountName.

 

I want my results to be grouped and sorted by AccountName and list the Contact names for each account within that account and each would have the usual arrow to go to the details of that unique "FullName" data entry.

 

The results should look like this:

Santa Cruz Software company (AccountName) 

Brian Jones (FullName)                                      >

David Super (FullName)                                     >

Flambeau (AccountName)

Alejandro Rosado (FullName)                            >

Basil Ledet (FullName)                                       >

Tom Kimble (FullName)                                     >

David Rutzler (FullName)                                   >

 

Is this even possible with a sort and group query or do these one-to-many relationships need to be separated into separate lists?

 

I am hoping a query can solve this because this is how we are being given the data...

 

I have attached the Excel file AccountLeads.xlsx

 

 

  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,422 on at
    Re: Sorting and grouping data results in Power Apps

    @GregoryGuth ,

    You need the GroupBy structure I posted with a nested gallery containing the Data table.

  • GregoryGuth Profile Picture
    GregoryGuth on at
    Re: Sorting and grouping data results in Power Apps

    Warren - I have this working (distinct sort 'AccountName') which gives me the first screen looking good except where I am challenged is the arrows no longer work as one account name may point to multiple user accounts. I assume I will need to create a custom next page that loads up the account details and then lists the people/contacts within that account. I am lost as to how to pass that data across and to make the initial arrow function correctly (pass on the AccountName.

  • WarrenBelz Profile Picture
    WarrenBelz 145,422 on at
    Re: Sorting and grouping data results in Power Apps

    @GregoryGuth ,

    The principle is the same - just you would have different data source and field names.

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • GregoryGuth Profile Picture
    GregoryGuth on at
    Re: Sorting and grouping data results in Power Apps

    It is made up sample data. I was hoping it would help.

  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,422 on at
    Re: Sorting and grouping data results in Power Apps

    Hi @SebS ,

    You did not say how you connecting this, but assuming direct to the Excel file, you would have a Gallery with the Items

    GroupBy(
     Table1,
     "AccountName",
     "Data"
    )

    then a nested gallery inside this with the Items

    ThisItem.Data

    and Labels inside that for all the fields (except AccountName which is in the main gallery)

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • SebS Profile Picture
    SebS 4,141 on at
    Re: Sorting and grouping data results in Power Apps

    @GregoryGuth 

     

    I really hope this is sample data and You just not breached GDPR but just in case if it's not a sample remove the file and replace it with some fake data 🙂

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard