cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Radoslavov
Helper V
Helper V

Calculate Age in Power Apps

Hi All,

 

It's being quite some time since my last question here and I'm seeking all professional's assistance here.

 

I'm building a Medical App that requires the Patient's age.

What is required from the Patient to enter is just his Sex and Date of Birth, the age will be calculated automatically using Todays Data and the Birthday Data input from the Calendar 

 

This is how the screen looks like:

Radoslavov_0-1612876640423.png

The Age number is actually the main information required for the app, so this file will be hidden from the user anyway.

Any suggestions on how to calculate the Age of a Patient?

I've tried this: DateDiff(Today(),userbirthdate.SelectedDate)

but I got the difference in days

Radoslavov_1-1612876805899.png

Radoslavov_2-1612876925851.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

Consider this:

DateDiff(StartDatePicker.userbirthdate,Today(),Years)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

3 REPLIES 3
eka24
Super User III
Super User III

Consider this:

DateDiff(StartDatePicker.userbirthdate,Today(),Years)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

Drrickryp
Super User II
Super User II

It’s not as simple as it looks because age is typically rounded down.  I did it for cds here https://powerusers.microsoft.com/t5/Microsoft-Dataverse/Calculating-age-in-CDS-entity/td-p/495528 

This is working,I just change the formula slightly to remove the age rounding as 29 years and 9 months even if it's close to 30, the medical records think otherwise when it comes to accuracy.

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (49,672)