I have a list for purchase agreements that has a column for start date, what I want is a way to populate another column with the month and day from the start date but with the current year. I assume this can be done through power automate but I can't figure out how.
Get Month and Day from one column and update another column with same month and day but current year
3 Answers
It is perhaps not particularly intuitive, but you want to create an expression using the 'addToTime' function. Something like this:
addToTime(outputs('Get_item')?['body/StartDate'],1,'Year')
where
outputs('Get_item')?['body/StartDate']
is your Start Date field from a previous action in your flow.
See here for a more detailed explanation: https://www.powertechtips.com/add-years-to-date-power-automate/
If the field is not required to be editable in the future, you can simply create a new calculated column, set as date with this formula:
=DATE(YEAR(2023),MONTH([Created]),DAY([Created]))
Where instead of [Created]
you can add your column name.
You can also use YEAR(TODAY())
, but please keep in mind that calculated fields are "recalculated" on item create/edit with TODAY()
so you might experience some issue so rather hardcode the correct value like YEAR(2O23)
or YEAR([Created]+1)
might be more suitable.
If you don't want to edit values in another date column in future using list forms, you can use calculated column formula for your another column.
Create a new calculated column with formula like:
=IF(ISBLANK([Start Date]),"",DATE(YEAR(TODAY()),MONTH([Start Date]),DAY([Start Date])))
This formula handles the case if Start Date column is blank.
Column Settings:
Output:
Note:
- Sometimes comma(
,
) does not work in formula (it is based on language or regional settings on your site). So in that case use semicolon(;
) instead of comma(,
). - Use correct display name of your SharePoint columns in above formula.
- Wrap column names inside
[]
if your column name has space in it. For example:[My Column Name]
.