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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
bcolgan4
Regular Visitor

Need help splitting column

Hey!

 

I am having trouble breaking this CSV file out into distinct columns. The file is a csv directory consisting of lines indicating a ProductID, followed by a colon, and then customer ids and rating dates, one per line for that ProductID. There are no empty lines in the file. For example:

 

Column1, Column2:

 

ProductID1:

CustomerID11, Date11
CustomerID12,Date12
...
ProductID2:
CustomerID21,Date21
CustomerID22,Date22

 

 

bcolgan4_0-1670541258265.png

bcolgan4_1-1670541328933.png

 

How do I break out a single column for each item? I've tried to used Split Column and delimiters but can't seem to get that to work. 

 

Column1, Column2, Column3

Product ID1, CustomerID11, Date11

ProductID1, CustomerID12, Date 12

ProductID1, CustomerIDI3, Date13

......

Product ID2, CustomerID21, Date21

ProductID2, CustomerID22, Date 22

.......

ProductID3, CustomerID31, Date31

 

I appreciate the help!

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

In power query, add a column using 'if then else'

The logic is : if column2 is empty or null or whatever then column1 else null

 

Then do a 'fill Down' on the new column.

Then filter out the null/empty rows from Column2

---

Alternatively, search the text in Column1 to see if contains ':' to make a slightly different 'if  then else'

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

In power query, add a column using 'if then else'

The logic is : if column2 is empty or null or whatever then column1 else null

 

Then do a 'fill Down' on the new column.

Then filter out the null/empty rows from Column2

---

Alternatively, search the text in Column1 to see if contains ':' to make a slightly different 'if  then else'

vicky_
Super User
Super User

You will need to go into Power Query and go to Transform > Pivot Column on the Items column. See this page for a better explanation of how pivoting works: https://support.microsoft.com/en-us/office/pivot-columns-power-query-abc9c8da-3be9-44c4-886e-0be331a...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.