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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Convert rows into columns

Hi All, wondering if anyone can help??

I have this set of date in this format 

Chloestevens88_0-1710857054366.png

and what i want it to look like is this

Chloestevens88_1-1710857160674.png

Almost like an unpivot with the Step being the header, but not with values.

 

Any ideas anyone?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Here is my sample data:

vjunyantmsft_0-1710904680806.png

 


Please try this M function, just put all of the M function into the Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnFV0lEy1DfUNzIwMgYyg0tSCxQMgYziksSiEqVYHfKVGAEZ+UUpqUVgJe5OOExJzkgswa0CZEhBUX5KaTLRNmFVAmKk5qUQbxFWRVBTFOBuJmgXWIEx3sAD24RTCZpd+I3CqgRLPJBrG5aAJsM2rEGNrgh7UGNTlZiemgdUEgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Market = _t, Date = _t, Step = _t, Context = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Market", type text}, {"Date", type date}, {"Step", type text}, {"Context", type text}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type"),
    #"Pivoted Column" = Table.Pivot(#"Removed Duplicates", List.Distinct(#"Removed Duplicates"[Step]), "Step", "Context")
in
    #"Pivoted Column"

 And the final output is as below:

vjunyantmsft_1-1710904700392.png


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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

Here is my sample data:

vjunyantmsft_0-1710904680806.png

 


Please try this M function, just put all of the M function into the Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnFV0lEy1DfUNzIwMgYyg0tSCxQMgYziksSiEqVYHfKVGAEZ+UUpqUVgJe5OOExJzkgswa0CZEhBUX5KaTLRNmFVAmKk5qUQbxFWRVBTFOBuJmgXWIEx3sAD24RTCZpd+I3CqgRLPJBrG5aAJsM2rEGNrgh7UGNTlZiemgdUEgsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Market = _t, Date = _t, Step = _t, Context = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Market", type text}, {"Date", type date}, {"Step", type text}, {"Context", type text}}),
    #"Removed Duplicates" = Table.Distinct(#"Changed Type"),
    #"Pivoted Column" = Table.Pivot(#"Removed Duplicates", List.Distinct(#"Removed Duplicates"[Step]), "Step", "Context")
in
    #"Pivoted Column"

 And the final output is as below:

vjunyantmsft_1-1710904700392.png


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

dufoq3
Community Champion
Community Champion

If you want us to help you, provide sample data in proper format.


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

dufoq3
Community Champion
Community Champion

Hi @Anonymous,

 

  • for future requests, provide sample data as table so we can copy/paste
  • this video should help you

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Anonymous
Not applicable

Thanks but this doesnt work with the additional columns for country and date 

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.