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 / collection plus column...
Power Apps
Answered

collection plus column repeated items

(0) ShareShare
ReportReport
Posted on by

Hi everybody

 

Sorry for the simple question but I still new to powerapps. I have a sharepoint list with columns:

 

User       Access date

A            01/12/2020

B            11/10/2020

B            23/11/2020

C            17/11/2020

A            05/12/2020

B            03/10/2020

 

I am trying to create a collection like below. Which User means the column with distinct users and Access represents the number of access of each user

 

User       Access

A              2

B              3

C              1

 

I am using code below which give me distincts user, however I dont know what to do for Visits columns

 

ClearCollect(
FSRVisits,
{
User: Distinct(Filter(sharepointlist,('Access Date'>= DatePicker_Start.SelectedDate) && ('Access Date'<= DatePicker_End.SelectedDate)),Username),
Visits: ????
}
)

 

The reason for creating a collection is that I want to use in a gallery sorting by Visits (decreasing) with the final result like:

User       Access

B              3

A              2

C              1

 

Any idea would be greatly appreciated.

 

Regards

 

Categories:
  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @Faribeiro 

    Here’s the code you can use to achieve your goal.

     

    Sort(DropColumns(AddColumns(GroupBy(your_sharepoint_list, “User”, "GroupedRows"), "Access", CountRows(GroupedRows)), “GroupedRows), Access, Descending)


    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Faribeiro Profile Picture
    on at

    Thanks mdevaney...it is working almost the way I want.

     

    How could I add a filter on the code you suggested? 

    Thank you again for your prompt answer.

     

    Filter(sharepoint_list, ('Access Date'>= DatePicker_Start.SelectedDate) && ('Access Date'<= DatePicker_End.SelectedDate))

  • Faribeiro Profile Picture
    on at

    mdevaney....thank you so much no only to guide me on the solution. I believe the filter is working now. I did like below:
    Sort(DropColumns(AddColumns(GroupBy(Filter(sharepointlist, ('Access Date'>= DatePicker_Start.SelectedDate) && ('Access Date'<= DatePicker_End.SelectedDate)), "Username", "GroupedRows"), "Access", CountRows(GroupedRows)), "GroupedRows"), Access, Descending)

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 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard