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
STIBBS_807
Resolver I
Resolver I

Appending Column of Duplicate Data into One Row

Need more assistance from the community. 

 

I have a excel spreadsheet with Monitor data in it.  It looks like this:

STIBBS_807_0-1621281880803.png

I would like to transform the data into this:

STIBBS_807_1-1621281938846.png

Here is my code so far:

let
Source = Csv.Document(File.Contents(" ....\Testing\Displays.csv"),[Delimiter=",", Columns=5, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Sorted Rows" = Table.Sort(#"Promoted Headers",{{"Computer", Order.Ascending}}),
#"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1, Int64.Type),
#"Removed Columns" = Table.RemoveColumns(#"Added Index",{"Manufacturer", "Model", "Description"})
in
#"Removed Columns"

 

I have tried other Merge Rows into One Row solutions from this community but with no success.  Wonder if someone would assist me in flattening out my data.

 

Thank you in advance.😊

 

2 ACCEPTED SOLUTIONS
HotChilli
Super User
Super User

We always prefer a data sample rather than a picture.

Anyway, the strategy is to add an Index (per Computer category) then perform a pivot on this new Index column to create the new column headings.

Step1 Group by Computer with new column "all" (choose 'All Rows')

Step 2 Add New Column with code like:

Table.AddIndexColumn([all], "Count", 1, 1)

Step 3 Expand the New Column (return everything and we'll tidy up columns after)

Step 4 Remove redundant columns.

Step 5 Select "Count" column and Pivot (from the Transform menu). Choose the Values column and 'Don't aggregate'

That should be it.

-------------------------

Let me know how it goes as that's some reasonably advanced operations. 

View solution in original post

Here is a sample of my data

ComputerManufacturerModelDescriptionSerial Number

8WOODSDRIVEACRACER V243HGeneric PnP MonitorLHG080334231
8WOODSDRIVEACRACER X233HGeneric PnP MonitorLG1080204220
FFD001ACRV277UGeneric PnP MonitorTDCAA002852A
FFD001GSM24MB35Generic PnP Monitor610NTMX00419
FFD001GSM24MB35Generic PnP Monitor610NTTQ00417
FFD601(Standard monitor types) Generic Non-PnP Monitor 
FFD602ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD603ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD604ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD605(Standard monitor types) Generic Non-PnP Monitor 
FFD606ACRAcer H236HLGeneric PnP MonitorLX1AA0034210
FFD607ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD608GSM24MB35Generic PnP Monitor609NTABCX552
FFD608GSM24MB35Generic PnP Monitor610NTSU00414
FFD609ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD610ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD612(Standard monitor types) Generic Non-PnP Monitor 
FFD613ACRAcer B236HLGeneric PnP MonitorLYXAA0014200
FFD613ACRV233HGeneric PnP MonitorLGT0C0444060
FFD614ACRACER V243HGeneric PnP MonitorLHG080334231
FFD614ACRV233HGeneric PnP MonitorLGT0C0444060
FFD615ACRACER X233HGeneric PnP MonitorLG1080204220
FFD616ACRS240HLGeneric PnP MonitorLU50D0128532

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the Excel file and in another tab of the file, show the expected result clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
HotChilli
Super User
Super User

We always prefer a data sample rather than a picture.

Anyway, the strategy is to add an Index (per Computer category) then perform a pivot on this new Index column to create the new column headings.

Step1 Group by Computer with new column "all" (choose 'All Rows')

Step 2 Add New Column with code like:

Table.AddIndexColumn([all], "Count", 1, 1)

Step 3 Expand the New Column (return everything and we'll tidy up columns after)

Step 4 Remove redundant columns.

Step 5 Select "Count" column and Pivot (from the Transform menu). Choose the Values column and 'Don't aggregate'

That should be it.

-------------------------

Let me know how it goes as that's some reasonably advanced operations. 

Here is a sample of my data

ComputerManufacturerModelDescriptionSerial Number

8WOODSDRIVEACRACER V243HGeneric PnP MonitorLHG080334231
8WOODSDRIVEACRACER X233HGeneric PnP MonitorLG1080204220
FFD001ACRV277UGeneric PnP MonitorTDCAA002852A
FFD001GSM24MB35Generic PnP Monitor610NTMX00419
FFD001GSM24MB35Generic PnP Monitor610NTTQ00417
FFD601(Standard monitor types) Generic Non-PnP Monitor 
FFD602ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD603ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD604ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD605(Standard monitor types) Generic Non-PnP Monitor 
FFD606ACRAcer H236HLGeneric PnP MonitorLX1AA0034210
FFD607ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD608GSM24MB35Generic PnP Monitor609NTABCX552
FFD608GSM24MB35Generic PnP Monitor610NTSU00414
FFD609ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD610ACRAcer S231HLGeneric PnP MonitorLNZ080024214
FFD612(Standard monitor types) Generic Non-PnP Monitor 
FFD613ACRAcer B236HLGeneric PnP MonitorLYXAA0014200
FFD613ACRV233HGeneric PnP MonitorLGT0C0444060
FFD614ACRACER V243HGeneric PnP MonitorLHG080334231
FFD614ACRV233HGeneric PnP MonitorLGT0C0444060
FFD615ACRACER X233HGeneric PnP MonitorLG1080204220
FFD616ACRS240HLGeneric PnP MonitorLU50D0128532

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.