Forum Discussion
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":
- 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.
- 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.
- Anonymous4 years ago
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])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.
4 Replies
- lbendlinSuper 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 - AnonymousNot applicable
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 - ccianciFrequent Visitor
Thank you both. Here's a sample data (cleaned for privacy) of what I'm talking about:
Item Full Name Name Email Title Start Date Leaving Date Joiner Doe, John [email protected] Vice President 2022-05-16 Joiner Low, Karen [email protected] Consultant 2022-03-21 Leaver Karen Low [email protected] 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
- AnonymousNot applicable
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])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.