Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
AnetaK
Helper V
Helper V

HR issue with DAX - first occurence of an employee after filtering

Hello,

 

I have this table with employees.

AnetaK_0-1633010889003.png

It has a relation with Calendar table.

 

My task is to create a measure that shows new hires first occurances on the date axis (edit: I want to show first occurance of the employee).

Now it's just a simple DAX: Hires = DISTINCTCOUNT('Employee'[Name]).

So we have such a table in PBI.

AnetaK_0-1633012463687.png

 

How to write this DAX so that:

- there is only one occurence ( 01/01/2019) when no filter is applied;

- when there's a filter Level=Mid there's a new hire an occurence only on 01/01/2019 and when there's a filter Level=Senior there's a new hire one only on 01/01/2021;

- when there's a filter Team=Bob there's a new hire only one occurence on 01/08/2021 ?

 

I'm stuck. Please, help.

 

5 REPLIES 5
AnetaK
Helper V
Helper V

Nobody? 😞

AnetaK
Helper V
Helper V

There is one employee - John Doe. We have his history in the table.

He started as a Mid in Anna's Team, then got promoted to Senior and later changed his team.

dedelman_clng
Community Champion
Community Champion

@AnetaK - you use case doesn't make sense then. The data does not support what you're asking, as there are 3 employees (with no filter), 2 Senior (with a filter on senior), 2 on Team Bob (with a filter on team).

 

Perhaps you can restate your use case / requirements?

 

David

AnetaK
Helper V
Helper V

It's the same on the line chart. It's just easier here to show it on the table.

AnetaK_0-1633018912781.png

 

Using COUNTROWS(Employee) instead of DISTINCTCOUNT makes no change.

 

 

dedelman_clng
Community Champion
Community Champion

Hi @AnetaK -

 

Don't create the table like you did. Just use the Start Date (or the Calendar date) as the X-axis, value is COUNTROWS(Employee).  Your filter will redraw the chart when you use them.

 

Hope this helps

David

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.