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 / Dataverse calculated c...
Power Apps
Answered

Dataverse calculated column to extract the year from date

(0) ShareShare
ReportReport
Posted on by 2,297
This seems the easiest thing in the world: a calculated column in dataverse like;
 
Year(MyDate)
 
But it returns the error:
Year cannot be performed on this input without a time zone conversion, which is not supported in formula columns.
Categories:
I have the same question (0)
  • Mark Nanneman Profile Picture
    991 Moderator on at
    I never found a way to accomplish this when I wanted to months ago--but there were other ways to do what I wanted that didn't even require the column.  If you absolutely must have a year column, you can create a plugin or flow to auto populate it off of your date column when the record is created or updated (to handle new records going forward)--and you can retroactively bulk populate your year column by doing an export to excel, using some quick excel formulas to fill in that column, and then importing the whole table back into dataverse for updates.

    Just some thoughts.
  • ronaldwalcott Profile Picture
    3,862 Moderator on at
    Year function only works on UTC dates
  • WebPortal Profile Picture
    2,297 on at
    @Mark Nanneman
     
    Sure, I have the year in Power Fx and I use it to filter a large Dataverse table.
    The issue is delegation. Thus, having the year on a column would help.
  • Suggested answer
    truc binh Profile Picture
    17 on at
    You can change field MyDate to Date Only or Timezone Independent. Then you can apply the Year function in Formula column
  • WebPortal Profile Picture
    2,297 on at
    @truc binh
     
    Thanks, but how may I do that?
     
    Here are the column specifications:
     
  • Mark Nanneman Profile Picture
    991 Moderator on at
    There's at least one option that works on large data sources with no delegation issues. 

    I have a demo I can share that uses a gallery of years to work like pages or filter selections.  It's created just using a simple sequence() function.



    Years Gallery:


    Formula for the dataverse gallery you want to filter by year:

     
    With(
     
        {
     
            startDate: DateTimeValue(Text(Date(gal_years_filter.Selected.Value,1,1),DateTimeFormat.UTC)),
     
            stopDate: DateTimeValue(Text(Date(gal_years_filter.Selected.Value,12,31),DateTimeFormat.UTC))
     
        },
     
        Sort(
     
            Search(
     
                Filter(
     
                    'Large Date Tables',
     
                    'Long Date' >= startDate And 'Long Date' <= stopDate
     
                ),
     
                txt_search.Value,
     
                Name
     
            ),
     
            'Long Date',
     
            SortOrder.Descending
     
        )
     
    )
     


    I've done versions of these where you can select multiple years from from your year gallery and it just finds the max and min from that collection to generate the start and stop filter dates.



    Example of the filtering:

    works very quickly,almost instant





    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  |
  • Suggested answer
    ronaldwalcott Profile Picture
    3,862 Moderator on at
    If you are forced to here is a weird way to do it.
     
    Add a new datetime column TestDateConstant which will default to January 1st 1900.
    The date that I want to extract the year from is called TestDate
    Create a formula field
    Text(DateDiff(TestDateConstant, TestDate, TimeUnit.Years) + 1900, "####")
     
    This gives you a text field with the year
     
  • Verified answer
    truc binh Profile Picture
    17 on at
    Hi @WebPortal,
     
    You can set in the box related to timezone below.

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!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard