cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ccianci
New Member

Fixing inconsistent names & missing titles

Hello all,

 

I have two issues I'm hoping you can help me with.  I'm fairly new to Power BI & Power Query and i'm working on a PBI report comparing joiners vs leavers over the last x years.  For your reference, the raw data file actually uses the values "joiners" and "leavers":

  1. One issue is the employee title.  In the query, all new hires have a title but the leavers do not.  My thought to get some of the data fixed is to do an XLOOKUP or similar formula.  Basically, it would be something like this - if the leaver's title is empty, then search all joiners for the full name.  if there's a match, copy the title over.  I know this wont fix all leavers but it should fix some. Since all the joiners and leavers are in one table, i thought it would be easiest to duplicate the query so there's one for joiners and one for leavers.  not sure if that helps or just makes things harder.

  2. The second issue is related to the one above.  I can't search for the user's name because the "full name" column was poorly entered by HR.  Some names are FIRST LAST and some are LAST, FIRST.  Some even have two spaces between FIRST LAST.
    Is there a power query formula I can use to clean this up or maybe create a new column with a uniform value - FIRST LAST?

 

Thank you for your help.

1 ACCEPTED SOLUTION
Eyelyn9
Community Support
Community Support

Hi @ccianci ,

 

You may add a new column:

Filled Title = 
var _title= CALCULATE(MAX('Table'[Title]),ALLEXCEPT('Table','Table'[Email]))
return IF([Title]=BLANK(),_title,[Title])

Eyelyn9_0-1654054351724.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Eyelyn9
Community Support
Community Support

Hi @ccianci ,

 

You may add a new column:

Filled Title = 
var _title= CALCULATE(MAX('Table'[Title]),ALLEXCEPT('Table','Table'[Email]))
return IF([Title]=BLANK(),_title,[Title])

Eyelyn9_0-1654054351724.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ccianci
New Member

Thank you both.  Here's a sample data (cleaned for privacy) of what I'm talking about:

 

ItemFull NameNameEmailTitleStart DateLeaving Date
JoinerDoe, John jdoe@email.comVice President2022-05-16 
JoinerLow, Karen klow@email.comConsultant2022-03-21 
Leaver Karen Lowklow@email.com  2022-05-15

 

First issue: Leaver title is missing (line 4) but since that same employee joined this year (line 3).  Is there a way to do a search in Power Query (or dax) to fill in that title?  If the search returns nothing, then leave the title blank.

 

Second issue: cancel this one - i figured out a solution using Power Query

Eyelyn9
Community Support
Community Support

Hi @ccianci ,

 

Any updates?

As @lbendlin mentioned , the information you have provided is not making the problem clear to us, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

 

Best Regards,
Eyelyn Qin

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors