web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Answered

Date Calculations

(0) ShareShare
ReportReport
Posted on by 271

I am new to Power Automate so I am playing with simple little things just to get a feel for this.

See the screenshot of my flow as it is now.

Daily Schedule: it runs once a day in the morning - no problem there.

Get Client Information - data is in dataverse.

Today: formatDateTime(utcNow(),'MM-dd')

Condition: checks if DOB column contains the MM-dd.

If true, sends a email to the customer service manager.

 

It works! Now, I want to improve the email by giving the age of the client.

 

Here is what I THINK should happen - please tell me if this will work.

I have to create a variable for the current year, another variable for the birth year, and do a calculation to determine the age. 

If I am right, please give me some guidance on how to make it happen.

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at

    @hildasteyn 

    If it's enough for you to substract years, you can get current year by means of the following WDL expression

     

    int(formatDateTime(utcNow(),'yyyy'))

     

    ...follow the same procedure to transform birthday into year of type int...

     

    int(formatDateTime(<birhthday date here in ISO 8601 format>,'yyyy'))

     

    ...and finally use WDL function sub() to do the math:

     

    sub(int(formatDateTime(utcNow(),'yyyy')),int(formatDateTime(<birthday in iso 8601 format here>,'yyyy')))

     

     

    Or, if you wanna be a bit more precise, I guess you can substract birthday from current date. If so, please have a look to Tom Riha's blog here on how to calculate difference between two date time strings by means of ticks difference:
    https://tomriha.com/how-to-calculate-difference-between-two-times-in-power-automate/
    Hope this helps!

  • Verified answer
    Linn Zaw Win Profile Picture
    2,996 on at

    @hildasteyn 

    Since you are only picking the records with the same day and month, you can simply calculate the age by subtracting the year of the DOB from the current year.

    Here's the expression for it and you just have to replace the logical name of the DOB column in the following one.

    sub
    (
     int(formatDateTime(utcNow(), 'yyyy')),
     int(formatDateTime(items('Apply_to_each')?['xyz_dob'], 'yyyy'))
    )

     

     

  • Hilda Steyn Profile Picture
    271 on at

    Okay you are my hero for the day! Thank you so much!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard