Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Qasim_Jan
Frequent Visitor

Calculate Age column

Hi experts,
Can you help me create the age column please.

Screenshot_20240314-102232.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Qasim_Jan 

 

@FreemanZ  Thanks for your sharing!

 

In response to your question, here are some details I provided:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1710832455742.png

 

Create a measure. Calculate age from the "Birth" date column and the "Today" date column.

 

Age = 
var _birthdate = SELECTEDVALUE('Table'[birthdate])
var _today = SELECTEDVALUE('Table'[Today])
var _year = DATEDIFF(_birthdate, _today, YEAR)
RETURN 
    IF(
        MONTH(_birthdate) <> MONTH(_today) || DAY(_birthdate) > DAY(_today), 
        _year - 1,
        _year
    )
    & " Year " &
    IF(
        MONTH(_birthdate) <> MONTH(_today) && DAY(_birthdate) < DAY(_today), 
        12 - MONTH(_birthdate) + MONTH(_today),
        IF(
            DAY(_birthdate) > DAY(_today),
            11 - MONTH(_birthdate) + MONTH(_today),
            0
        )
    )
    & " Month " &
    IF(
        DAY(_birthdate) < DAY(_today),
        DAY(_today) - DAY(_birthdate), 
        DAY(EOMONTH(_birthdate, 0)) - DAY(_birthdate) + DAY(_today) -2
    )
    & " Day"

 

Here is the result.

 

vnuocmsft_1-1710832617377.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Johnndan
New Member

I was having the same problem when I needed to calculate age in Excel. To achieve this, you can use a simple formula involving the DATEDIF function. First, ensure that your date of birth is in one cell and the current date is in another. Then, in the cell where you want the age to appear, enter the formula =DATEDIF(B2, TODAY(), "Y") where B2 is the cell containing the date of birth. This formula calculates the difference in years between the date of birth and the current date, effectively giving you the age. Hope this helps!

Anonymous
Not applicable

Hi @Qasim_Jan 

 

@FreemanZ  Thanks for your sharing!

 

In response to your question, here are some details I provided:

 

Here's some dummy data

 

"Table"

vnuocmsft_0-1710832455742.png

 

Create a measure. Calculate age from the "Birth" date column and the "Today" date column.

 

Age = 
var _birthdate = SELECTEDVALUE('Table'[birthdate])
var _today = SELECTEDVALUE('Table'[Today])
var _year = DATEDIFF(_birthdate, _today, YEAR)
RETURN 
    IF(
        MONTH(_birthdate) <> MONTH(_today) || DAY(_birthdate) > DAY(_today), 
        _year - 1,
        _year
    )
    & " Year " &
    IF(
        MONTH(_birthdate) <> MONTH(_today) && DAY(_birthdate) < DAY(_today), 
        12 - MONTH(_birthdate) + MONTH(_today),
        IF(
            DAY(_birthdate) > DAY(_today),
            11 - MONTH(_birthdate) + MONTH(_today),
            0
        )
    )
    & " Month " &
    IF(
        DAY(_birthdate) < DAY(_today),
        DAY(_today) - DAY(_birthdate), 
        DAY(EOMONTH(_birthdate, 0)) - DAY(_birthdate) + DAY(_today) -2
    )
    & " Day"

 

Here is the result.

 

vnuocmsft_1-1710832617377.png

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.