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
Anonymous
Not applicable

Get just one date from multiple rows with the same date

Hi all,

 

I have a table like the one below, where I have hireDate and terminationDate broken up by individuals, identifiable by their empID. The problem is, a person could have worked in multiple departments as denoted in the departmentCommonName column, in which case they will have multiple rows. This will create multiple rows with the same hireDate and terminationDate for the same person. I am using these dates to calculate attrition, so I want to add in another column which will pull out only one of these pairs of dates for the employee, that way when I count for attrition I only count the person once. So in the data below, we can see that employee 206 has 5 sets of hireDate and terminationDate which are the same, but I want a column which will show this pair only once for employee 206, and then the same for all of the other employees. Any suggestions?

 

example 3 power bi.PNG

Thank you!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I've found a way to solve it for my specific case, matching up the term date with the last day with client date (since they should only match when the employee has been termed anyway). Thanks for the replies all!

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

I've found a way to solve it for my specific case, matching up the term date with the last day with client date (since they should only match when the employee has been termed anyway). Thanks for the replies all!

parry2k
Super User
Super User

@Anonymous may be easier is that in query editor, make copy of your table, remove all unwanted columns, keep emp name, hire and terminate date and remove duplicate rows. At the end  you will have unique row for each employee and then it will be much easier to work from there.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k Thanks for your reply! This sounds good, but the problem is that I will need attrition to eventually be broken up by departmentCommonName and empLocation, but if I remove those columns in another table I won't know which people were in which group when I try to add them up. Any suggestions?

@Anonymous well if you don't have termination date by department, you cannot achieve that anyhow so not sure how you are planning to do it?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k I do have termination date by department actually, it is shown as the lastDayWithClient column. Sorry for not explaining it thoroughly! What is most important here for me right now is actually empLocation, where I need to be able to count and break out attrition by empLocation which has multiple categories. This is why I wanted to get a column which shows the hire and termination date only once per person so that once I broke it out by location, it would not overcount attrition.

Hi @Anonymous 

 

You might consider creating pbix file that will contain some sample data, upload the pbix to onedrive or dropbox and share the link to the file. Please do not forget to describe the expected results based on this sample data.

 

Community Support Team _ Dina Ye
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.