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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I have a table with employee data with the following information-
Employee number, name, fte, dob, age, date
There is a row for every month they are employed with us.
I need to show a bar chart with a count by of staff sliced by age.
The outcome will mean I am able to see the count drop when people reach a set age
Example
If 25 staff hit 65 in Sept 2023 then the total number for sept will be 65 less.
I also have a date table.
Thank you
Solved! Go to Solution.
Hi @SamBowdell ,
I suggest you to create a data model as below.
Fact table:
Measure:
Count by Age =
VAR _SELECTAGE =
SELECTEDVALUE ( DimAge[Age] )
VAR _STEP1 =
ADDCOLUMNS (
ALL ( 'Table' ),
"Current Age", QUOTIENT ( DATEDIFF ( 'Table'[Dob], MAX ( DimDate[Date] ), MONTH ), 12 )
)
RETURN
COUNTAX ( FILTER ( _STEP1, [Current Age] < _SELECTAGE ), [Name] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @SamBowdell ,
I suggest you to create a data model as below.
Fact table:
Measure:
Count by Age =
VAR _SELECTAGE =
SELECTEDVALUE ( DimAge[Age] )
VAR _STEP1 =
ADDCOLUMNS (
ALL ( 'Table' ),
"Current Age", QUOTIENT ( DATEDIFF ( 'Table'[Dob], MAX ( DimDate[Date] ), MONTH ), 12 )
)
RETURN
COUNTAX ( FILTER ( _STEP1, [Current Age] < _SELECTAGE ), [Name] )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @SamBowdell
1. Create a calculated column using.
Retired = IF('EmployeeTable'[Age] >= 65, "Yes", "No")
2. Create measure for active employee count.
ActiveCount = CALCULATE(
COUNT('EmployeeTable'[Employee number]),
FILTER('EmployeeTable', 'EmployeeTable'[Retired] = "No")
)
Hope this helps.
Proud to be a Super User!
I want to be able to select any age
try using SELECTEDVALUE DAX. here is the documentation
https://learn.microsoft.com/en-us/dax/selectedvalue-function
Proud to be a Super User!
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 53 | |
| 42 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 124 | |
| 105 | |
| 44 | |
| 32 | |
| 24 |