- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

How do I calculate the duration between two date in Years and months (not days) in Power Query
How do I calculate the duration between two dates in Years and/or months (not days) in Power Query
I need to insert a column which will show the age of the customer when they purchased their product. I have their date of birth and the transaction date - I need to report on the age of customer at transation date in Years.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I was being lazy and forgtot to round decimal places....
= Table.AddColumn(#"Changed Type", "Years", each Number.Round(Duration.Days([Purchase] - [Birth])/365,2), type number)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

this is great James - I will give it a try now - Im assuming I go to powerquery - add column - custom column ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Yea thats correct, let me know if you get stuck and I can add screenshots.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi,
Give this a go (assumed coumns are called Birth and Purchase)
= Table.AddColumn(#"Changed Type", "Years", each Duration.Days([Purchase] - [Birth])/365, type number)
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I was being lazy and forgtot to round decimal places....
= Table.AddColumn(#"Changed Type", "Years", each Number.Round(Duration.Days([Purchase] - [Birth])/365,2), type number)

Helpful resources
Power BI Monthly Update - July 2025
Check out the July 2025 Power BI update to learn about new features.
