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 / Total created count fo...
Power Apps
Answered

Total created count for user within a record

(0) ShareShare
ReportReport
Posted on by

Hello,

 

Scenario:

 

When a user clicks on a record in a Gallery (Data source is a SharePoint list) I have a label outside the gallery which I want to count the number of items created by the user who created that record. So whomever the user is in the "Created By" field of that record, I wish to have a total count of how many items they created in that SharePoint list.

 

How can I accomplish this? Also, the count need to be just for the current year and start again next January 1st.

 

Hope this is not too confusing.

 

Thanks in advance.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at

    Hi @ShadowTech ,

    Put this is a label to test

    With(
     {
     wList: 
     Sort(
     YourSPList,
     ID,
     Descending
     )
     },
     CountRows(
     Filter(
     wList,
     Year(Created) = Year(Now()) && 'Created By'.DisplayName = User().FullName
     )
     )
    )

    For a gallery displaying all users and their totals

    With(
     {
     wList: 
     Sort(
     YorSPList,
     ID,
     Descending
     )
     },
     AddColumns(
     GroupBy(
     AddColumns(
     Filter(
     wList,
     Year(Created) = Year(Now())
     ),
     "Creator",
     'Created By'.DisplayName
     ),
     "Creator",
     "Data"
     ),
     "CreatedNo",
     CountRows(Data)
     )
    )

     

    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.

  • ShadowTech Profile Picture
    on at

    @WarrenBelz Hello, Just to be clear I have the following being filtered in the gallery right now. The SharePoint list in in a collection.

     

    I do have multiple values from a "Status" field in addition to the total count the created user has created. So I would need to get these total counts (for the year) for the other values.

     

    Status filed values:

     

    Unopened

    Validating

    Completed

     

    What would be the best way to incorporate that into my formula?

     

    Sort(Filter(Search(AddColumns(Branch1, "CreateBy", 'Created By'.DisplayName), SearchBar.Text, "Title", "CompanyName", "CustomerContact", "Tag_x0023_", "CreateBy"),If(StatusDropdown.Selected.Value="All",true,Status.Value=StatusDropdown.Selected.Value),If(DispostionDropdown.Selected.Value="All",true, Disposition.Value=DispostionDropdown.Selected.Value),If(RushOTCheckbox.Value=true,'Rush Overtime',RushOTCheckbox.Value= false ),If(QuoteReqdCheckbox.Value=true,'Quote Req''d',QuoteReqdCheckbox.Value= false )),Created,Descending)

     

    Thanks again.

  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at

    @ShadowTech ,

    Can you please use Format Text when you post code - it saves a heap of time on this end trying to parse it all.

    That aside, your code is not grouped by 'Created By', so there is nowhere to add the totals in. If you use GroupBy as per my post, all your other fields (single instances of them) will disappear and simply be part of the grouped column, so the rest of your code, Search and Filter) will not work (it has no field to search in or filter by).

    Also, please post the full code involved in your problem in your initial post as my response can only be based on the information provided.

     

    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.

     

  • ShadowTech Profile Picture
    on at

    @WarrenBelz I was hoping that I could have to code in the label look and calculate the counts when clicked on each record in the Gallery. Maybe by targeting the Selected.ID of the selected record and running the calculation that way.

     

    ???

     

    Thanks,

  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at

    @ShadowTech ,

    So what you actually want has nothing to do with the gallery code (it cannot be incorporated into that), but what to put on a label to show the number that the creator of the selected record has done?

    With(
     {
     wList: 
     Sort(
     YourSPList,
     ID,
     Descending
     )
     },
     CountRows(
     Filter(
     wList,
     Year(Created) = Year(Now()) && 
     'Created By'.DisplayName = YourGalleryName.Selected.'Created By'.DisplayName
     )
     )
    )

     

    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.

  • ShadowTech Profile Picture
    on at

    @WarrenBelz That's what I was looking for...

     

    CountRows(
     Filter(
     sharepointlist,
     'Created By'.DisplayName = Gallery1.Selected.'Created By'.DisplayName
     )
     )

     

    So how would I do that but for status field?

     

    Status.Value="Unopened"

     

    Thanks again for the help.

  • Verified answer
    WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at

    @ShadowTech ,

    Like this I assume

    CountRows(
     Filter(
     sharepointlist,
     'Created By'.DisplayName = Gallery1.Selected.'Created By'.DisplayName &&
     Status = "Unopened"
     )
    )

     

    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.

  • ShadowTech Profile Picture
    on at

    @WarrenBelz That works greats. Thanks again. I have two more to finish this off If I can get your assistance on this?

     

    1. Label that counts how many days since an item(record) has been created.

    2. label that counts total records even when filtering/Search.

     

    Again thanks for your help.

  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at

    @ShadowTech ,

    First label

    DateDiff(
     ThisItem.Created,
     Now(),
     Days
    )

    Second I am not sure what you mean exactly, but this earlier code I posted (slightly modified)

    With(
     {
     wList: 
     Sort(
     YourSPList,
     ID,
     Descending
     )
     },
     CountRows(
     Filter(
     wList,
     Year(Created) = Year(Now()) && 
     'Created By'.DisplayName = ThisItem.'Created By'.DisplayName
     )
     )
    )

    should show on each record the number produced (in the current year) by the user who created that record. Also if your initial question is solved, please accept that solution as well.

     

    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.

  • ShadowTech Profile Picture
    on at

    @WarrenBelz First one worked great.

     

    To clarify, this last one is not tied to a user just the filtering of the gallery.

     

    Example:

     

    default filter = total count of all records in data source.

    filtering and/or search = total count of records within filter/search results.

     

    Hope that clarified.

     

    Thanks

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard