Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

transpose Data

Hello,  Please a  a junior in Bi and i've this challenge to do can u please assist me ? I've this table code   pay  No amount   date g124    2    100000         2/4/2024 g124    1     500       ...
  • Ashish_Mathur's avatar
    2 years ago

    Hi,

    Just in case you want a Power Query solution, try this code

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"code", type text}, {"pay", Int64.Type}, {"No amount", Int64.Type}, {"date", type date}}),
        #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"code", "pay"}, "Attribute", "Value"),
        #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Unpivoted Other Columns", {{"pay", type text}}, "en-IN"),{"Attribute", "pay"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
        #"Pivoted Column" = Table.Pivot(#"Merged Columns", List.Distinct(#"Merged Columns"[Merged]), "Merged", "Value")
    in
        #"Pivoted Column"

    Hope this helps.