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 / Convert datetime colum...
Power Apps
Answered

Convert datetime column into year column

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello guys, I need your help.

 

I've a column of datetime in Sharepoint list. I want to use this column to create dropdown of a year in the list. 

This is what i want.

BaywareNNN_2-1670583145537.png

 

 

What I think is I need to create a collection from Sharepoint list with datetime column and convert this column in to year (use Year function) then use Distinct function to filter out the duplicate.

 

My collection name yearyear and the column name is DateofOccurence.

BaywareNNN_0-1670582990092.png

 

The problem is Year function is not enable to convert table.   

BaywareNNN_1-1670583108381.png

 

 

Please help me to convert my datetime column in the collection to year column.

 

Or any advise to complete this is very helpful.

 

Thanks.

Categories:
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @Anonymous 

     

    You could add the following code to the Items property of your dropdown:

    Distinct(
     AddColumns(
     colDates,
     "Year",
     Year(ThisRecord.Value)
     ),
     Year
    )

     

    However, you could also fix this by creating a year collection and using the distinct of those values:

     

    ForAll(
     colDates,
     Collect(
     colYearOfDates,
     Year(ThisRecord.Value)
     )
    )

     

    I hope this helps!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks!!! LaurensM

     

    This is really solved my problem.

     

    Wish you have a good day!

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 318

#3
Mohsin Ali Profile Picture

Mohsin Ali 220

Last 30 days Overall leaderboard