Forum Discussion

loretto1665's avatar
loretto1665
Frequent Visitor
2 years ago
Solved

Xero software

Hi   Is anyone uploading transaction reports to power query and cleaning them up to use in power BI?  Trying to get the Audit & Accountacny decription away from the date and have it running down th...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi loretto1665 

    Do you mean you want to split the description and date to two columns?

    You can refer to the following solution.

    Sample data 

    Put the following code to advanced editor in power query

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WstA3tNQ3MjAyDkisTEzKSVXwzCvLz0xOjUgtylfQVfDNzyvJyKlUKC5NKk4uyiwoyczPU4rViVayJFOfoYG+oTnJGmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Audit & Accountancy fees" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Audit & Accountancy fees", type text}}),
        #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Audit & Accountancy fees", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Audit & Accountancy fees.1", "Audit & Accountancy fees.2", "Audit & Accountancy fees.3"}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Audit & Accountancy fees.1", Int64.Type}, {"Audit & Accountancy fees.2", Int64.Type}, {"Audit & Accountancy fees.3", type text}}),
        #"Split Column by Position" = Table.SplitColumn(#"Changed Type1", "Audit & Accountancy fees.3", Splitter.SplitTextByPositions({0, 4}, false), {"Audit & Accountancy fees.3.1", "Audit & Accountancy fees.3.2"}),
        #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Position",{{"Audit & Accountancy fees.3.1", Int64.Type}, {"Audit & Accountancy fees.3.2", type text}}),
        #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type2", {{"Audit & Accountancy fees.1", type text}, {"Audit & Accountancy fees.2", type text}, {"Audit & Accountancy fees.3.1", type text}}, "en-US"),{"Audit & Accountancy fees.1", "Audit & Accountancy fees.2", "Audit & Accountancy fees.3.1"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Date"),
        #"Changed Type3" = Table.TransformColumnTypes(#"Merged Columns",{{"Date", type date}})
    in
        #"Changed Type3"

    Output

    Best Regards!

    Yolo Zhu

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

     

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi loretto1665 

    You can put the following code to advanced editor in power query

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrTUt9A3MjAyDkisTEzKSVXwzCvLz0xOjUgtylfQVfDNzyvJyKlUKC5NKk4uyiwoyczPU4rVAeuzJEufub6hAckaYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Audit & Accountancy fees" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Audit & Accountancy fees", type text}}),
        #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Audit & Accountancy fees", Splitter.SplitTextByDelimiter("/", QuoteStyle.Csv), {"Audit & Accountancy fees.1", "Audit & Accountancy fees.2", "Audit & Accountancy fees.3"}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Audit & Accountancy fees.1", Int64.Type}, {"Audit & Accountancy fees.2", Int64.Type}, {"Audit & Accountancy fees.3", type text}}),
        #"Split Column by Position" = Table.SplitColumn(#"Changed Type1", "Audit & Accountancy fees.3", Splitter.SplitTextByPositions({0, 4}, false), {"Audit & Accountancy fees.3.1", "Audit & Accountancy fees.3.2"}),
        #"Changed Type2" = Table.TransformColumnTypes(#"Split Column by Position",{{"Audit & Accountancy fees.3.1", Int64.Type}, {"Audit & Accountancy fees.3.2", type text}}),
        #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type2", {{"Audit & Accountancy fees.1", type text}, {"Audit & Accountancy fees.2", type text}, {"Audit & Accountancy fees.3.1", type text}}, "en-US"),{"Audit & Accountancy fees.1", "Audit & Accountancy fees.2", "Audit & Accountancy fees.3.1"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Date"),
        #"Changed Type with Locale" = Table.TransformColumnTypes(#"Merged Columns", {{"Date", type date}}, "en-GB")
    in
        #"Changed Type with Locale"

     

    Best Regards!

    Yolo Zhu

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