Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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"
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.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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!
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"
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.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |