cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyNeutron
Helper II
Helper II

Grabbing the year from a date column

Simple question here, so I have a date format column. So each record has a date item, that's listed as mm/dd/yyyy. So for example, 4/16/2016 (The record reads 4, not 04, not sure if that will make a difference). I was wondering if there was a quick and easy way to grab the last 4 numbers. I want to group the records by the year. 

 

My goal is to make a line graph that lists the number of records for each year without any hard-coding. I'm mostly stuck on just reading the year component. 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@JimmyNeutron 

It depends on the columns type - if it is a date column, then you can use the Year function.

    Year(yourColumn)

If it is a text column, then you can use the Right function.

    Right(yourColumn, 4)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@JimmyNeutron 

It depends on the columns type - if it is a date column, then you can use the Year function.

    Year(yourColumn)

If it is a text column, then you can use the Right function.

    Right(yourColumn, 4)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

TheRobRush
Power Participant
Power Participant

If your column is properly formatted as a date (not just a string that looks like one) throwing Year() around a date will return the year. If it's just a a string you can double up year with datevalue like

 

Year(DateValue("04/22/2021"))

 

and then you always have this method as well.

 

Right("04/22/2021",4)

 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!
TheRobRush
Power Participant
Power Participant

Sorry for the double answer think me and @RandyHayes must have been answering in unison haha!

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!
RandyHayes
Super User III
Super User III

@TheRobRush 

That happens!  Confirms the answer though 😁

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,053)