Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
54 | |
24 | |
23 | |
15 | |
11 |
User | Count |
---|---|
76 | |
60 | |
46 | |
17 | |
12 |