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
AlejandroPCar
Helper IV
Helper IV

Data Wranglig with the Query Editor

Hi! 

 

I need help with "raw" data. I have a table with a list thousands companies names. But, the problem is the name column has several different names for the same company trough the years. For example the company name in 2009 is "Muebles LTDA" , but in the year 2015 the name is "Muebles LTDA." and for 2014 is "MueblesLTDA" and 2016 has "muebles ltda". 

 

So even when the name it is the SAME for all the years, Power BI understand it as a different name by year because some years has uppercase, some lower, some has a dot at the end some has double space between words, etc... 

 

Is there a way to unify those names? I mean, have the original name column with the raw data and an other column with the data ready to go, so in front of every wrong name is the Real name. Something like this: 

 

Orignal NameReal Name
muebles ltdaMuebles LTDA
Muebles LTDA.Muebles LTDA
Mueble LTDAMuebles LTDA
Muebles    LTDAMuebles LTDA
Muebles LTDAMuebles LTDA

 

 

Thanks for your help, have a nice day. 

 

Alejandro 

1 ACCEPTED SOLUTION
v-xjiin-msft
Solution Sage
Solution Sage

@AlejandroPCar

 

In your scenario, you have thousands company names. And maybe one same company will have several different names. So you want to format these different names into a same one. Right?

 

First, you should know that in Power Bi, if you want to change the Upper/Lower cases. You just need to go to Query Edit -> Transform -> Format.

 

Then to achieve your requirement, I’m afraid first you have to make a mapping list manually then do the format. To do this, I would suggest you to use Power Query. Please refer:

 

Go to Query Edit in Power BI desktop - > Right Click your source table and go to Advanced Edit - > define a mapping function like below:

 

let 
    fnChoose_CustCode = (input) => let
    values = {
    {"MUEB", "Muebles LTDA"},
    {"AAAA", "AAAA"},
    {input,"Undefined"}
    },
    Result = List.First(List.Select(values, each _{0}=input)){1}
in
Result,

Source = …

Then create a new Custom Column, and specify it with expression like: = fnChoose_CustCode(Text.Range([Orignal Name],0,4)).

 

11.PNG22.PNG

Reference: https://www.excelguru.ca/blog/2014/09/03/multi-condition-logic-in-power-query/

 

Thanks,
Xi Jin.

View solution in original post

2 REPLIES 2
v-xjiin-msft
Solution Sage
Solution Sage

@AlejandroPCar

 

In your scenario, you have thousands company names. And maybe one same company will have several different names. So you want to format these different names into a same one. Right?

 

First, you should know that in Power Bi, if you want to change the Upper/Lower cases. You just need to go to Query Edit -> Transform -> Format.

 

Then to achieve your requirement, I’m afraid first you have to make a mapping list manually then do the format. To do this, I would suggest you to use Power Query. Please refer:

 

Go to Query Edit in Power BI desktop - > Right Click your source table and go to Advanced Edit - > define a mapping function like below:

 

let 
    fnChoose_CustCode = (input) => let
    values = {
    {"MUEB", "Muebles LTDA"},
    {"AAAA", "AAAA"},
    {input,"Undefined"}
    },
    Result = List.First(List.Select(values, each _{0}=input)){1}
in
Result,

Source = …

Then create a new Custom Column, and specify it with expression like: = fnChoose_CustCode(Text.Range([Orignal Name],0,4)).

 

11.PNG22.PNG

Reference: https://www.excelguru.ca/blog/2014/09/03/multi-condition-logic-in-power-query/

 

Thanks,
Xi Jin.

Thank you @v-xjiin-msft 

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.