## Desktop

Member
Posts: 52
Registered: ‎04-14-2017

# Calculating age from a date and time

[ Edited ]

I'd be extreemly grateful if someone could help with this. I have a column containing date and time information. From this I need to create a new column which shows the age based on the date (in days).

I also have a seperate dataset with a start date and end date (date and time) which I need to calculate the days between the start and end.

Accepted Solutions
Highlighted
Super User
Posts: 1,474
Registered: ‎05-10-2016

## Re: Calculating age from a date and time

Use "New Column" not "New Measure"

Lima - Peru
Power BI

All Replies
Super User
Posts: 1,474
Registered: ‎05-10-2016

## Re: Calculating age from a date and time

hi,

To calculate the age in Days:

Age = DATEDIFF(Table1[DateTimeColumn],TODAY(),DAY)

to calculate the days between the start and end.

DaysBetween = DATEDIFF(Table1[StarDate],Table1[EndDate],DAY)

Lima - Peru
Power BI
Member
Posts: 52
Registered: ‎04-14-2017

## Re: Calculating age from a date and time

Thanks you...

I seem to have done something wrong (assuming it's me as a newbie):

Super Contributor
Posts: 1,468
Registered: ‎11-25-2016

## Re: Calculating age from a date and time

My best guess is that you need to choose "New Column" first.

Specializing in Power Query Formula Language (M)
Highlighted
Super User
Posts: 1,474
Registered: ‎05-10-2016

## Re: Calculating age from a date and time

Use "New Column" not "New Measure"

Lima - Peru
Power BI
Member
Posts: 52
Registered: ‎04-14-2017

## Re: Calculating age from a date and time

Thank you for taking the time to help me, it's much appreciated.