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

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.

Reply
DrNossberg
New Member

Dax Function - See transfered people

 

Hello BI community 🙂

 

I would like to now in Power BI the number of people who changed entreprise

Assigned NumberLegal Start Date Person Hire DatePerson Termination  DateEmployerIDTransfert
E75H3F-214/08/201812/04/2018 Entreprise A894561
E75H3F14/08/201802/11/201810/04/2018Entreprise B894560
E75H3F14/08/201802/11/201810/04/2019Entreprise B894561
AH1J9114/08/201814/08/201830/10/2018Entreprise A894560
AH1J9114/08/201814/08/201830/10/2018Entreprise A894560

So the transfert column is what I what, following those conditions:

The ID is the same

The Employer is different

The Assigned Number is different too

The Termination date of the previous entry is max 5 days before the hire date

 

The last is a thought one, and that's why i'm requesting your help.

 

What I have so far is:

 

Transfert  = IF(COUNTROWS(CALCULATETABLE('Data';
     FILTER('Data'; 'Data'[ID] = EARLIER('Data'[ID]));
     FILTER('Data'; 'Data'[Employer] <> EARLIER('Data'[Employer]));
     FILTER('Data'; DATEDIFF(EARLIER('Data'[Termination Date]); 'Data'[Hire Date); DAY) <= 5)
)) > 0 ; 1; 0)

But that's not working, in fact every record concernig a person who has been transfered is set to 1, like this:

Assigned NumberLegal Start Date Person Hire DatePerson Termination  DateEmployerIDTransfert
E75H3F-214/08/201812/04/2018 Entreprise A894561
E75H3F14/08/201802/11/201810/04/2018Entreprise B894561
E75H3F14/08/201802/11/201810/04/2019Entreprise B894561
AH1J9114/08/201814/08/201830/10/2018Entreprise A894561
AH1J9114/08/201814/08/201830/10/2018Entreprise A894561

 

Thanks in advance, have a good day ^^

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@DrNossberg,

 

You may check if the following post helps.

https://community.powerbi.com/t5/Desktop/date-difference-from-list-of-related-dates/m-p/569179#M2686...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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