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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Babycakes_00
Regular Visitor

Pivot or Group

Hi all I have a data set that I need to Change the structure and format

 

Any suggestions to reformat this data?

 

Desired Outcome is

FORM IDDate outDateInReceivalNoIDNameLocationTestSizeComment
12311/26/2024 00:00:009/11/2024 0:009999991LisaActionTest  
12411/27/2024 00:00:0011/27/2024 00:00:00156338Not SetJohnActionTestSmall 
12511/27/2024 00:00:0011/27/2024 00:00:00156338Not SetBillActionTestSmall 

 

Current Format is

FORM IDEntryIDNameValue
1233486Date out11/26/2024 00:00:00
1233487DateIn9/11/2024 0:00
1233488ReceivalNo999999
1233489ID1
1233490NameLisa
1233491LocationAction
1233492TestTest
1233493Size 
1233494Comment 
1243606Date out11/27/2024 00:00:00
1243607DateIn11/27/2024 00:00:00
1243608ReceivalNo156338
1243609IDNot Set
1243610NameJohn
1243611LocationAction
1243612TestTest
1243613SizeSmall
1243614Comment 
1251552Date out11/27/2024 00:00:00
1251553DateIn11/27/2024 00:00:00
1251554ReceivalNo156338
1251555IDNot Set
1251556NameBill
1251557LocationAction
1251558TestTest
1251559SizeSmall
1 ACCEPTED SOLUTION
dharmendars007
Memorable Member
Memorable Member

Hello @Babycakes_00 

 

In Power Query you can follow this simple steps to get the table stucture you want.

  1. Select the FORM ID and Name columns.
  2. Go to the Transform tab and click on Pivot Column.
  3. Use Value as the "Values Column."

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

View solution in original post

4 REPLIES 4
v-xinruzhu-msft
Community Support
Community Support

Hi @Babycakes_00 

Dod the solutions dharmendars007 , Chewdata  and tackytechtom  offered help you solve the problem, if them help, you can consider to accept them as solutions so that more user can refer to, or if you have other problems, you can offer some information so that can provide more suggestion for you.

 

Best Regards!

Yolo Zhu

dharmendars007
Memorable Member
Memorable Member

Hello @Babycakes_00 

 

In Power Query you can follow this simple steps to get the table stucture you want.

  1. Select the FORM ID and Name columns.
  2. Go to the Transform tab and click on Pivot Column.
  3. Use Value as the "Values Column."

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Chewdata
Resolver IV
Resolver IV

Hey!

This can be achieved by using the pivot function in Power query. 
To achieve this, first remove the column that makes every row unique ( [ EntryID]). 
Secondly use Table.Pivot on the name and value columns. Selecting Don't aggregate in the advanced options.

Chewdata_0-1733393361777.png


Codesnippet:

let
    Source = YOURTABLE,
    #"Removed Columns" = Table.RemoveColumns(Source,{"EntryID"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Name]), "Name", "Value")
in
    #"Pivoted Column"


 

tackytechtom
Super User
Super User

Hi @Babycakes_00 ,

 

How about this? 🙂

tackytechtom_0-1733345700649.png

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jZA9b4MwEIb/CmKOhD/AQLe2WRJFDKFblMFClmoJ8BC3Q399z9Yl5YRFg5De072PDH4ul5wLme9yWTYKYq+9ydyXh5HzQqhCMFFmjL3EN7/uFnyN/GGGoS0CH+EV2ECczWDstx47F+D4UKiFOOzDd8m+ZRCdngzEyd40LXnYukF768JPvA5xIIiA+DA3fw9ShujtTzg8o00J8e6mycx+UYatVCxhqk6aQp6Y+pde6eKVkrKh0ENX53zWG09avpB2dJ8zLbekIZKWhuVCWj/pcaRtWlwVr1GJZ8UhL58Th3S5KQ6hKi0OW/Un7s0+roZlvSEOkSYpDst2Je76Cw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"FORM ID" = _t, EntryID = _t, Name = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"FORM ID", Int64.Type}, {"EntryID", Int64.Type}, {"Name", type text}, {"Value", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"EntryID"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Name]), "Name", "Value")
in
    #"Pivoted Column"

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors