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
alan7lp
Helper III
Helper III

Extract text from a Multi-Line value

Hello,

 

I would like to know if there is a way in Power Query to extract the full first line of a text from a multi-line value. I have a column with data like this:

Description
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...!

Beginner Course Page:
https://xxxxxxxxxxx.com/courses/xxxxxxxx-beginner/

XXXXXXXXX YouTube Channel:
https://www.youtube.com/
---------------------------------------------------------------------------------------------------

To enroll in my introductory or advanced Power BI courses:
https://XXXXXXXXXXXXXXXXX/

XXXXXXXXXXXXX Consulting:
https://XXXXXXXX.com/

Tools:
https://www.XXXXXXXXXX.com/

Connect with me on Twitter!
https://twitter.com/XXXXXXXXXX
Proin dapibus sapien magna, a consectetur nisi feugiat et. Nulla vestibulum pulvinar turpis, ut placerat odio vulputate quis. Nam semper dapibus magna. Suspendisse nec ipsum sed nunc sagittis semper placerat eu sem.

Blog
https://XXXXXXXXXXX.com/

XXXXXXXXX:
https://XXXXXXX.com/

XXXXXXX Tools:
https://www.XXXXXXXXX.com/
Est erat, condimentum id quam sit amet, aliquam accumsan velit. Praesent non metus pellentesque, porttitor mi vitae, tempor metus. In sem eros, interdum ac finibus eu, sagittis molestie eros. Integer pulvinar vulputate felis vulputate blandit. Phasellus nec libero maximus, egestas urna eget, consectetur tortor.

To enroll in my introductory or advanced Power BI courses:
https://XXXXXXXXXXXX/

XXXXXXXXXX Consulting:
https:XXXXXXXXXX.com

Connect with me on Twitter!
https://twitter.com/XXXXXXXXXXX

 

I would like to be able to extract only the text that is marked in orange. 

I was able to get the desired result in Excel with the following formula: 

 

 

=LEFT(A2, SEARCH(CHAR(10), A2)-1)

 

 

 

But, I need it in Power Query because I do not have access to the data source that comes with the format shown in the table above and extracting it to excel is not an option.

 

Is there any way this can be achieved, please?

Thanks a lot in advance,

Cheers.

Alan

1 ACCEPTED SOLUTION
Anonymous
Not applicable

5 REPLIES 5
Anonymous
Not applicable

try this

I'm trying in PowerQuery. Can you please paste the formula/code 

Check the solution post, you can download the PBIX with the solution written in Power Query.

 

Regards,

Works wonders @Anonymous 🙂

 

Would you mind to explain me how this formula works, especially the last part "#(lf)"

Thank you!

Anonymous
Not applicable

"#(lf)"  plays the role that char (10) plays in your excel formula.

The formula says to take everything in the text that comes before the first (line feed) it encounters

(in the function I used there is an optional parameter - which in this case it was not necessary to use - which indicates the nth delimiter character you want to use. If you wanted, for example, to extract the first two paragraphs, you could use this additional parameter to indicate this choice).

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.

Top Solution Authors
Top Kudoed Authors