This is an amazing feature as it allows you to extract the age out of the date provided. Let us elaborate on this feature using an example.
Extract Age Using Date With Power Query
Here, we have a data table containing employee information which includes their Date of the Birth column. If you want to calculate the age of each employee it will consume a lot of time. To overcome this, Power Query has a solution which can solve this problem within a fraction of second.
Step 1: Select Column before Adding Age
To add an age column, we first have to select the DOB (date of Birth) column as shown in the picture below.
Step 2: Calculate Age from Date Column
To calculate age using DOB column in Power Query, go to-
Add Column > Date > Age
Step 3: After Age Column for Formatting
After you add the age column it is presented in the time format. To convert it into years you need to first select the column as shown below.
Step 4: Convert Age from Time to Years Format
To convert age column from time format to years format, go to-
Transform > Duration > Total Years
Step 5: Round Down Age Column
After selecting the Total Years option, your Age column will get converted into age. To round down the age click on the Rounding option and select Round Down. The picture below shows the final output.
You can learn more :
- Steps to Split Column By Number Of Characters in Excel
- How to do Duplicate Columns in Power Query
- How to Format Columns Using Power Query
- Steps to Append Queries in Excel