Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I used the DAX formula below to create a list of active employees with their corresponding ages based on the latest year available from my Year visual filter using Between style for my slicer.
Solved! Go to Solution.
Looks like you have an active relationship between Calender and hr_coredata[DateofHire]. You want to include all employees hired before the end of the selection year. I suggest changing the measure like this:
Age Measure =
VAR _selyear =
MAX(_Calendar[Year])
VAR _age =
CALCULATE(
DATEDIFF(SELECTEDVALUE(hr_coredata[DOB]),DATE(_selyear, 12, 31 ), YEAR ),
ALL(_Calendar),_Calendar[Year]<=_selyear)
RETURN
_age
Looks like you have an active relationship between Calender and hr_coredata[DateofHire]. You want to include all employees hired before the end of the selection year. I suggest changing the measure like this:
Age Measure =
VAR _selyear =
MAX(_Calendar[Year])
VAR _age =
CALCULATE(
DATEDIFF(SELECTEDVALUE(hr_coredata[DOB]),DATE(_selyear, 12, 31 ), YEAR ),
ALL(_Calendar),_Calendar[Year]<=_selyear)
RETURN
_age
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
19 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
25 | |
10 | |
10 | |
9 | |
6 |