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

DataFormat.Error, Can't trim text

Hi,

I'm a quit beginner in Power BI and I know this issue was reported multiple times before but unfortunately, I did try multiple solutions I found here however not working!

I was trying to import data from excel file where there is a text column contains multiple values separated by Comma, Colon and line feed, then I used to split that text into rows/columns

The issue is there are values where is need to display as numbers and it works for almost all cases except some, where there is still some spaces were not trimmed at the beginning of the text so it gives an error,

I did try multiple solutions: 

1- Trim & clean
2- Clean Whitespace Function:       
                               (text as text, optional char_to_trim as text) =>
                                        let
                                        char = if char_to_trim = null then " " else char_to_trim,
                                        split = Text.Split(text, char),
                                        removeblanks = List.Select(split, each _ <> ""),
                                        result=Text.Combine(removeblanks, char)
                                        in
3- Splitter.SplitTextByDelimiter (Space)
4- Splitter.SplitTextByWhitespace

Not sure if I did explain my issue well, so HERE you can find the sample file with the query,

Thanks in advance!

1 ACCEPTED SOLUTION

@Anonymous here is the working query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nVuxkl23Df2VO6o1GQIECVJt3DgzSRxnJo3XhQql0qjwrIp0/qDkp/wlOby7+wjg4ia2NbOFnpZ4JAgcnANQP/zwjmafZfT27v27P3/3zd+Pb79/en5//PUvx4c6Ks/OlZ+en969P7795vhwEEsfXc6P1u/94+Pnr5+OD1z6ux/fn8ZGa8pvxv50/PPj18/PD4v4t6GD+FifLINEc4ypbGzR4Kefnr6k6yfX3tWu59JGncWsH3q7vIsoh+XSqJNZruV2eZuzSlxeCjW/+4cnauGZuVWI+qy8rcCho4m1otufMrPLeXquTUWsnadnWIKLiz3O0/OQtm31kuwItmYXGtFWJ6LibFHVfTr4LTndlCnNn06b1m7siMrDx/9/pfqVj+/vNLPvb7Uzy7aCkK1D4azD2Km17HMgolOfsOis0SezzCneJ3Dpw79akj3BFvKmyfC2tNQyq7fV9r4aNU7Oh4SZ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ciqcam8OIRARwegm+8Xfzq5vmtrlbcZcwA1lqCu40xvnmp3Noa8cSuN6jfvLM1CLU541fiWe3KFOCSvbrNZwGrIx9KAvfqNZYg8kJj13StwdWySfhJa2e/jiWRwf50phvPmtqqq2O2mOjx0JKtjTbYzG9rM/A9JStNoFikEU/6OGWR2ZHBgKFZ+V4dCQR0i3iybPtZk1X/o6UNpFWx4p50avezJjMAA4hnaLIecV5IrbqxdLUd43nT9ltPZK4NtqZhJOfqN2VvPM7nyqPHh/iQB42CrpllP6ygFCxf3/SqGzEfr+80QAiNvfVp2/+jo9yRi/raL3PROdebYrc5XvXzx/8C", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Case Number" = _t, Description = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Case Number", Int64.Type}, {"Description", type text}}),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"Description", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Description"),
    #"Replaced Value" = Table.ReplaceValue(#"Split Column by Delimiter","_x000D_","",Replacer.ReplaceText,{"Description"}),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Replaced Value", "Description", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Description.1", "Description.2", "Description.3", "Description.4"}),
    #"Split Column by Delimiter3" = Table.SplitColumn(#"Split Column by Delimiter2", "Description.2", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Description.2.1", "Description.2.2"}),
    #"Split Column by Delimiter4" = Table.SplitColumn(#"Split Column by Delimiter3", "Description.3", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Description.3.1", "Description.3.2"}),
    #"Split Column by Delimiter5" = Table.SplitColumn(#"Split Column by Delimiter4", "Description.4", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Description.4.1", "Description.4.2"}),
    #"Filtered Rows" = Table.SelectRows(#"Split Column by Delimiter5", each ([Description.1] <> "#(cr)")),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Description.2.1", "Description.3.1", "Description.4.1"}),
    #"Trimmed Text" = Table.TransformColumns(#"Removed Columns",{{"Description.4.2", Text.Trim, type text}}),
    #"Cleaned Text" = Table.TransformColumns(#"Trimmed Text",{{"Description.4.2", Text.Clean, type text}}),
    #"Replaced Value1" = Table.ReplaceValue(#"Cleaned Text",Character.FromNumber(8237),"",Replacer.ReplaceText,{"Description.4.2"}),
    #"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1",Character.FromNumber(8236),"",Replacer.ReplaceText,{"Description.4.2"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value2", "Custom", each Text.Length([Description.4.2])),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Description.4.2", type number}})
in
    #"Changed Type1"

 



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.

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@Anonymous can you share pbix file with sample data and what steps you applied, will look into 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

Thanks @parry2k Please find the pbix file here with the sample data and steps

@Anonymous there are so many queries which specific one  you are looking at?



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 seems like some of the characters are not getting cleaned, see image below, it is giving length of the string to be different (5 and 4) whereas it suppose to be 3. Trying to find out what are the special character not getting cleaned. 



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 here is the working query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nVuxkl23Df2VO6o1GQIECVJt3DgzSRxnJo3XhQql0qjwrIp0/qDkp/wlOby7+wjg4ia2NbOFnpZ4JAgcnANQP/zwjmafZfT27v27P3/3zd+Pb79/en5//PUvx4c6Ks/OlZ+en969P7795vhwEEsfXc6P1u/94+Pnr5+OD1z6ux/fn8ZGa8pvxv50/PPj18/PD4v4t6GD+FifLINEc4ypbGzR4Kefnr6k6yfX3tWu59JGncWsH3q7vIsoh+XSqJNZruV2eZuzSlxeCjW/+4cnauGZuVWI+qy8rcCho4m1otufMrPLeXquTUWsnadnWIKLiz3O0/OQtm31kuwItmYXGtFWJ6LibFHVfTr4LTndlCnNn06b1m7siMrDx/9/pfqVj+/vNLPvb7Uzy7aCk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DRbQi46n4XTnPGxNCLbNUPE7EhG+uR6nvkfEICqBLlv94MvvZFGDQgU5ziQS/GVm2nRrLciqcam8OIRARwegm+8Xfzq5vmtrlbcZcwA1lqCu40xvnmp3Noa8cSuN6jfvLM1CLU541fiWe3KFOCSvbrNZwGrIx9KAvfqNZYg8kJj13StwdWySfhJa2e/jiWRwf50phvPmtqqq2O2mOjx0JKtjTbYzG9rM/A9JStNoFikEU/6OGWR2ZHBgKFZ+V4dCQR0i3iybPtZk1X/o6UNpFWx4p50avezJjMAA4hnaLIecV5IrbqxdLUd43nT9ltPZK4NtqZhJOfqN2VvPM7nyqPHh/iQB42CrpllP6ygFCxf3/SqGzEfr+80QAiNvfVp2/+jo9yRi/raL3PROdebYrc5XvXzx/8C", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Case Number" = _t, Description = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Case Number", Int64.Type}, {"Description", type text}}),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"Description", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Description"),
    #"Replaced Value" = Table.ReplaceValue(#"Split Column by Delimiter","_x000D_","",Replacer.ReplaceText,{"Description"}),
    #"Split Column by Delimiter2" = Table.SplitColumn(#"Replaced Value", "Description", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Description.1", "Description.2", "Description.3", "Description.4"}),
    #"Split Column by Delimiter3" = Table.SplitColumn(#"Split Column by Delimiter2", "Description.2", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Description.2.1", "Description.2.2"}),
    #"Split Column by Delimiter4" = Table.SplitColumn(#"Split Column by Delimiter3", "Description.3", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Description.3.1", "Description.3.2"}),
    #"Split Column by Delimiter5" = Table.SplitColumn(#"Split Column by Delimiter4", "Description.4", Splitter.SplitTextByDelimiter(":", QuoteStyle.Csv), {"Description.4.1", "Description.4.2"}),
    #"Filtered Rows" = Table.SelectRows(#"Split Column by Delimiter5", each ([Description.1] <> "#(cr)")),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Description.2.1", "Description.3.1", "Description.4.1"}),
    #"Trimmed Text" = Table.TransformColumns(#"Removed Columns",{{"Description.4.2", Text.Trim, type text}}),
    #"Cleaned Text" = Table.TransformColumns(#"Trimmed Text",{{"Description.4.2", Text.Clean, type text}}),
    #"Replaced Value1" = Table.ReplaceValue(#"Cleaned Text",Character.FromNumber(8237),"",Replacer.ReplaceText,{"Description.4.2"}),
    #"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1",Character.FromNumber(8236),"",Replacer.ReplaceText,{"Description.4.2"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value2", "Custom", each Text.Length([Description.4.2])),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Description.4.2", type number}})
in
    #"Changed Type1"

 



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

I got it and it's working perfectly! thanks a lot @parry2k 

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.