cancel
Showing results for 
Search instead for 
Did you mean: 
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
Rocco_sprmnt21
Community Champion
Community Champion

3 REPLIES 3
Rocco_sprmnt21
Community Champion
Community Champion

try this

Works wonders @Rocco_sprmnt21 🙂

 

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

Thank you!

"#(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
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors