Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Gunzel
New Member

Date Matrix into Tabular Data

Apologies if this has been asked before or is too basic, I'm unable to solve it. 

How am I able to convert the following table 

 

Names

01/02

01/02

02/02

02/02

 

Qty

Code

Qty

Code

X

10

E10

10

E10

Y

10

E10

10

E10

 

to 

 

Dates

Names

Qty

Code

01/02

X

10

E10

02/02

Y

10

E10

 

1 REPLY 1
ams1
Responsive Resident
Responsive Resident

Hi,

 

IF what you really want is:

ams1_0-1677592697657.png

 

And your input table looks like:

ams1_1-1677592738202.png

 

then one option is:

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table11"]}[Content], // CHANGE table name here
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type any}, {"Column3", type any}, {"Column4", type any}, {"Column5", type any}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Column1"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Column1"}, {{"All", each _, type table [Column1=nullable text, Attribute=text, Value=any]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.SelectRows(#"Grouped Rows", each [Column1] = null)[All]{0}[Value]),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Table.SelectRows(#"Grouped Rows", each [Column1] = "Names")[All]{0}[Value]),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Custom.2", each Table.FromColumns(Table.ToColumns([All]) & {[Custom]} & {[Custom.1]})),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom2", each ([Column1] <> null) and ([Column1] <> "Names")),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Custom.2"}),
    #"Expanded Custom.2" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom.2", {"Column1", "Column2", "Column3", "Column4"}, {"Column1", "Column2", "Column3", "Column4"}),
    #"Pivoted Column" = Table.Pivot(#"Expanded Custom.2", List.Distinct(#"Expanded Custom.2"[Column3]), "Column3", "Column2"),
    #"Renamed Columns" = Table.RenameColumns(#"Pivoted Column",{{"Column4", "Dates"}, {"Column1", "Names"}})
in
    #"Renamed Columns"

 

 

Please mark this as answer if it helped.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.