Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I have Employees data in Power BI to calculate the count of employees by age group, I have created measure to calculate the age dynamically based on selected date against each employee ID
Now I want to get the count of employees for each group instead of each Employee ID.
The final output will look like this
Solved! Go to Solution.
Hi @ubaid2001 ,
Please try:
Count =
VAR _table = SUMMARIZE('Table','Table'[EmployeeID],"group",[AgeGroup])
VAR _cur_age_group = MAX('Age Groups'[Age Groups])
VAR _result = COUNTROWS(FILTER(_table,[group]=_cur_age_group))
RETURN
_result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi @ubaid2001 ,
Please create a new table like:
And a new measure like:
Count =
VAR _table = SUMMARIZE('Table','Table'[EmployeeID],'Table'[Age],"group",[AgeGroup])
VAR _cur_age_group = MAX('Age Groups'[Age Groups])
VAR _result = COUNTROWS(FILTER(_table,[group]=_cur_age_group))
RETURN
_result
Output:
The result returned by the measure is dynamically calculated, which should work.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi,
I have Employee ID in table, but age and age group both are measures, can you please help me with that.
Age Measure = DATEDIFF(MAX('fact_employee_history'[DOB]), MAX(dim_calendar[Date]), YEAR)
Thanks
Hi @ubaid2001 ,
Please try:
Count =
VAR _table = SUMMARIZE('Table','Table'[EmployeeID],"group",[AgeGroup])
VAR _cur_age_group = MAX('Age Groups'[Age Groups])
VAR _result = COUNTROWS(FILTER(_table,[group]=_cur_age_group))
RETURN
_result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi @ubaid2001
You can simply take that column twice (age group) and set other age group to count like below. In my case sorting is my calculated column.
I hope i answered your question!
I am not able to get the count of Age Group measure
Hi @ubaid2001
Please calculate the Age group in Column not measure.
Once I am calculating it in column then it is not changing the group based on age dynamically.
Age measure is calculating the age dynamically based on selected date.
You'll create a calculated column based on your measure. and then just create a new measure using DISTINCTCOUNT
can you please explain your solution in detail.
Thanks
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.