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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Steffen1
Frequent Visitor

Transforming Data from row to column

Dear Community,

 

I am looking for a solution to transform a value from a cell into a column, my source is looking as following: 

 

Steffen1_0-1673345603983.png

 

Now I would like to structure the data in columns only and get rid of the 3 header rows. 

 

However I need the data from the HEADER1 row. Therefore I would like to transfer the diffrent values from that row into column´s. 

 

Thank you very much for the support

 

Best Regards

 

Steffen

 

1 ACCEPTED SOLUTION

@Steffen1 I did this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lY9NCsJADIWvIl2Xkp+ZzGRZaMGFdaFYhNL7X8MMNtWKiF3kTRJevkmmqTr2bddfsKorgQCKxMFyhAawISC2ghUhpMZaVgxtf7MnWlAk08OSzbXDSjdxIUVZDN/jNcI/fe59IlNWEAkhQtmnG5eVGcoR17K8CkYGgZzK/+PZJORVbA6yiOZ/mcOGmdmZiVz2M08bpoIzJbjsZ943UDM6lNVlP5Q+qLieT+ryTp0f", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t, Column7 = _t, Column8 = _t, Column9 = _t]),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Column1] = "12345678906644500" or [Column1] = "HEADER1")),
    #"Added Custom" = Table.AddColumn(#"Filtered Rows", "Column10", each if [Column1] = "HEADER1" then [Column2] else null),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Column11", each if [Column1] = "HEADER1" then [Column3] else null),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Column12", each if [Column1] = "HEADER1" then [Column4] else null),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "Column13", each if [Column1] = "HEADER1" then [Column5] else null),
    #"Filled Down" = Table.FillDown(#"Added Custom3",{"Column10", "Column11", "Column12", "Column13"}),
    #"Filtered Rows1" = Table.SelectRows(#"Filled Down", each ([Column1] = "12345678906644500"))
in
    #"Filtered Rows1"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Steffen1
Frequent Visitor

Dear @AlB , @Greg_Deckler,

 

thank you very much for your very fast replies, please find below the requested: 

 

here the input: 

HEADER160409123410.01.2023391047.0.0MAEU5252 252
HEADER273123456       
HEADER3        
12345678906644500DV1234301S196153060876VN48484500086698
12345678906644500DV1234301M196153060883VN72724500086698
12345678906644500DV1234301L196153060890VN64644500086698
12345678906644500DV1234301XL196153060906VN39394500086698
12345678906644500DV12343012XL196153060913VN29294500086698

 

here the desired outcome: 

 

12345678906644500DV9742301S196153060876VN4848450008669860409123410.01.2023391047.0.0MAEU
12345678906644500DV9742301M196153060883VN7272450008669860409123411.01.2023391047.0.1MAEU
12345678906644500DV9742301L196153060890VN6464450008669860409123412.01.2023391047.0.2MAEU
12345678906644500DV9742301XL196153060906VN3939450008669860409123413.01.2023391047.0.3MAEU
12345678906644500DV97423012XL196153060913VN2929450008669860409123414.01.2023391047.0.4MAEU

 

Best Regards

 

Steffen

 

@Steffen1 I did this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lY9NCsJADIWvIl2Xkp+ZzGRZaMGFdaFYhNL7X8MMNtWKiF3kTRJevkmmqTr2bddfsKorgQCKxMFyhAawISC2ghUhpMZaVgxtf7MnWlAk08OSzbXDSjdxIUVZDN/jNcI/fe59IlNWEAkhQtmnG5eVGcoR17K8CkYGgZzK/+PZJORVbA6yiOZ/mcOGmdmZiVz2M08bpoIzJbjsZ943UDM6lNVlP5Q+qLieT+ryTp0f", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t, Column7 = _t, Column8 = _t, Column9 = _t]),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Column1] = "12345678906644500" or [Column1] = "HEADER1")),
    #"Added Custom" = Table.AddColumn(#"Filtered Rows", "Column10", each if [Column1] = "HEADER1" then [Column2] else null),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Column11", each if [Column1] = "HEADER1" then [Column3] else null),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Column12", each if [Column1] = "HEADER1" then [Column4] else null),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "Column13", each if [Column1] = "HEADER1" then [Column5] else null),
    #"Filled Down" = Table.FillDown(#"Added Custom3",{"Column10", "Column11", "Column12", "Column13"}),
    #"Filtered Rows1" = Table.SelectRows(#"Filled Down", each ([Column1] = "12345678906644500"))
in
    #"Filtered Rows1"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler,

 

Oh, **bleep**,  this is a so easy solution, I guess I spend too much time thinking on it. 

 

Thank you very much

AlB
Community Champion
Community Champion

Hi @Steffen1 

Can you share the input and expected output tables? At least the input table in text-tabular format so that its contents can be readily copied

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Greg_Deckler
Community Champion
Community Champion

@Steffen1 Can you post that data as text?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Kudoed Authors