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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
danextian
Super User
Super User

Split a cell into multiple columns

Hi All,

 

I need your help again.

 

1/11 communication
1/10 communication
1/9 communication
1/6 communication
1/5 communication
1/4 I emailed the following:
items a
items b

 

Above is the content of a single cell. I want to split them into multiple rows per line break  - that's char(10) in excel -  and get the earliest date. I know i cant split them into multiple columns but I just can't find the function in Power BI Desktop to split them into rows. 

 

The splitting step is where I am stuck with. After I done with that step, I can just extract the text string until right before the first blank space, convert the strings to date, replace text (items a & items b lines) with null and remove them, sort the remaining rows in ascending order and remove the duplicates.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@danextian@Phil_Seamark

Indeed, the feature doesn't work in this case.

The code of the recorded code line is:

 

= Table.ExpandListColumn(Table.TransformColumns(Source, 
{{"Spalte ""1""", Splitter.SplitTextByDelimiter("#(#)(lf)", QuoteStyle.Csv),
let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}),
"Spalte ""1""")

By simply adjusint the part

Splitter.SplitTextByDelimiter("#(#)(lf)",

to

Splitter.SplitTextByDelimiter("#(lf)",

 

it works as desired.

 

View solution in original post

6 REPLIES 6
Phil_Seamark
Employee
Employee

Hi @danextian

 

You could try the great now "split into rows" feature that was introduced in a recent version of Power BI Desktop

 

So use the Query Editor and do the following.  Highlight your column and split on special character #(lf) into rows

.

split LF into rows.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

Thanks for the reply.

 

I tried your advise to break a cell by line feed into rows. Unfortunately, it didn't work. Doing so does nothing.

I tried to split the cells into column and they did.  The feature is there but i don't think it is working.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

@danextian@Phil_Seamark

Indeed, the feature doesn't work in this case.

The code of the recorded code line is:

 

= Table.ExpandListColumn(Table.TransformColumns(Source, 
{{"Spalte ""1""", Splitter.SplitTextByDelimiter("#(#)(lf)", QuoteStyle.Csv),
let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}),
"Spalte ""1""")

By simply adjusint the part

Splitter.SplitTextByDelimiter("#(#)(lf)",

to

Splitter.SplitTextByDelimiter("#(lf)",

 

it works as desired.

 

@Anonymous

 

by the way, upon checking Power BI does this Splitter.SplitTextByDelimiter("/#(lf)",










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

@danextian

Didn't know that one - thanks

Smiley Happy

Hi @Anonymous, thanks for this. It works. 

 

By the way, is there a way in Power BI to split into a column into multiple columns using multiple delimeters - not just a space or comma but either a space or comma?










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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