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

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

View solution in original post

TheRobRush
Impactful Individual
Impactful Individual

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
Impactful Individual
Impactful Individual

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

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (3,041)