• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel-How to Convert Vertical Date to Horizontal (attachmet Excel)

Prajnan ks

New Member
How to Convert two vertical Data by keeping one Vertical and other Horizontally??
 

Attachments

  • Book5.xlsx
    9.1 KB · Views: 9
Pivot your data in Power Query. Here is the Mcode for those steps. File attached for your review.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"PO No"}, {{"Data", each _, type table [PO No=nullable number, Desc=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Data],"Index",1,1)),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Desc", "Index"}, {"Custom.Desc", "Custom.Index"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Data"}),
    #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Removed Columns", {{"Custom.Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Custom.Index", type text}}, "en-US")[Custom.Index]), "Custom.Index", "Custom.Desc")
in
    #"Pivoted Column"
 

Attachments

  • Book5.xlsx
    25.1 KB · Views: 10
Pivot your data in Power Query. Here is the Mcode for those steps. File attached for your review.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"PO No"}, {{"Data", each _, type table [PO No=nullable number, Desc=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Data],"Index",1,1)),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Desc", "Index"}, {"Custom.Desc", "Custom.Index"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Data"}),
    #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Removed Columns", {{"Custom.Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Custom.Index", type text}}, "en-US")[Custom.Index]), "Custom.Index", "Custom.Desc")
in
    #"Pivoted Column"

OHH Waah Thank U So Much Sir, Hurry
 
365 also has solutions. For example, calculating distinct PO nos. 'DistinctPO's using the first formula, will allow the rows of the output table to be calculated one-by-one using the second formula.
Code:
= UNIQUE(PONo)

=TRANSPOSE(FILTER(Desc, PONo=@DistinctPO#))
 
365 also has solutions. For example, calculating distinct PO nos. 'DistinctPO's using the first formula, will allow the rows of the output table to be calculated one-by-one using the second formula.
Code:
= UNIQUE(PONo)

=TRANSPOSE(FILTER(Desc, PONo=@DistinctPO#))
Hi Can u Upload Excle File Please
 
Back
Top