Age Grouping - Filter Context

HI DNA Team,

I grouped employees AGE into age groups using below dax:

Age Grouping = CALCULATE([Employees],
FILTER(VALUES(‘HR Data’[Age]),
COUNTROWS(
FILTER(‘Age Group’,
‘HR Data’[Age] >= ‘Age Group’[Min] &&
‘HR Data’[Age] <= ‘Age Group’[Max] )) > 0))

Everything works correct, but when I select the age category 22-25 to see who are these employees the filter doesn’t apply:

If I select employees then they are shown in the group categories

Age pattern.pbix (412.1 KB)

Could you please advise what could cause the issue?

Hello!

You can click on the Table and add Age Grouping as Filter on the visual = 1

1 Like

Hi @alexbadiu :slight_smile:

It worked!

Thank you,

What would be the explanation that we need to add the filter of aged grouping is it because there is no relationship between HR data and Age grouping table (dim table) ?

Thank you,

Matty

Yes @Matty! Your assumption is right!
There is no relationship between the tables: “Age Group” and “HR data”.

In the table used you have: Full Name column and Average Salary measure (that calculates the average annual salary from the table HR Data.)

There is no way to communicate with Age Groups.

For this reason, you build the measure Age grouping. Through this measure you can leverage the age coming from the table “HR Data” to your Age groups in a dynamic way.

@alexbadiu Thank you for the clarification and explanation, sometimes I forgot how DAX works :slight_smile: !

Thank you,

Matty

1 Like