Forum Discussion

ericet's avatar
ericet
Helper I
3 years ago
Solved

How do I use a function on my 15,000+ column ?

How do I use a function on my 15,000+ column ?   I have a table with a column of 15,000 plus names, some of these names were sometimes entered with a french accentted character and sometimes not. ...
  • PhilipTreacy's avatar
    3 years ago

    Hi ericet 

     

    Download sample PBIX file

     

    Using Chris's code, create a separate blank query and copy/paste the function code into it, then save it.  I named my function ReplaceDiacritic.  You now have a custom function you can use.

     

    To actually use the function, add a Custom Column to your table/data and call the function like so, passing int he name column as the function input.

     

     

     

    Giving this result

     

     

    Here's my example query but if you look at the file above it'll make more sense.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WOtxZlJmsFKsTreSYe3hlTmYqmB12eGVRfl5mYSmE6waSqQAzgw6vzK0Es3wOr8zPg0gXJeYdXp6fWYzKg+g93JmTWZyYlFqSAea6A01OzEnJzAPKxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each ReplaceDiacritic([Name]))
    in
        #"Added Custom"

     

    regards

     

    Phil