cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

How to count records within the current year?

I am trying to see how many records each person has entered for the current year from a sharepoint list. Here is what I have below:

 

"Current Year Count for " & User().FullName & ": " & CountRows( Filter(
Collection1,
Created >= Date(Year(Today()), Year(Today()), 1),
Created < Date(Year(Today()), 1 + Year(Today()), 1), IsMatch( 'Created By'.Email, User().Email)))

 

Please Help! Thank you 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @Anonymous ,

You just need to use Year(Created), then it will return the created year.

Try this formula:

"Current Year Count for " & User().FullName & ": " & CountRows( Filter(Collection1,Year(Created)=Year(Today())))

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Continued Contributor
Continued Contributor

Weeeelll...copying/pasting your calculation:

Date(Year(Today()), Year(Today()), 1)

...into a label gives:

3/1/2187

...so maybe start there.  Smiley LOL

Highlighted
Community Support
Community Support

Hi @Anonymous ,

You just need to use Year(Created), then it will return the created year.

Try this formula:

"Current Year Count for " & User().FullName & ": " & CountRows( Filter(Collection1,Year(Created)=Year(Today())))

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Anonymous
Not applicable

Wow, this method is so much more effective. Thank you! 

 

Here's what I came up with!

 

CountRows( Filter(
Collection1,
Created >= Date(Year(Today()), 1, 1),
Created < Date(Year(Today()), 12, 31), IsMatch( 'Created By'.Email, User().Email)))

Highlighted
Anonymous
Not applicable


@v-yutliu-msft wrote:

Hi @Anonymous ,

You just need to use Year(Created), then it will return the created year.

Try this formula:

"Current Year Count for " & User().FullName & ": " & CountRows( Filter(Collection1,Year(Created)=Year(Today())))

 

Best regards,

Community Support Team _ Phoebe Liu


Will this also work on a table. I have grouped my data by the creator and then I want to count how many each user can submitted how many entries for the year. I have made a gallery to put these two columns in. 

 

GroupBy(AddColumns(Collection1, "UserDisplayName", 'Created By'.DisplayName), "UserDisplayName", "GroupByUsersDisplayName")

 

CountRows( Filter(GroupByUsersDisplayName,Year(Created)=Year(Today())))

 

It seems like it is working, but I just want to make sure. 

Highlighted
Continued Contributor
Continued Contributor

Yes, this will work on a Table (i.e. Collection).  PowerApps essentially treats (for the most part) any complex data type that groups fields together into a Collection and any of the functions you see that do operations on data sources are treating those sources as Collections as well.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (13,157)