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
Super User II
Super User II

3 REPLIES 3
Rocco_sprmnt21
Super User II
Super User II

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
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors