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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
vanessafvg
Super User
Super User

M Gurus help :)

I have a facebook post that has hundres of entries in it that i want to pull into different rows and columns.   I think mostly what i am struggling with is, a removing the first 2 lines that are highlighted, then splitting the date and % into 2 columns and different rows for each line.   Any tips would be great.

 

Capture.PNG





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




1 ACCEPTED SOLUTION
erik_tarnvik
Solution Specialist
Solution Specialist

Remove top three lines (or four, hard to tell from picture) and then split column delimited by "- ". That would generate the M code below.

 

let
    Source = Table.FromColumns({Lines.FromBinary(File.Contents("C:\testdata.txt"), null, null, 1252)}),
    #"Removed Top Rows" = Table.Skip(Source,3),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Top Rows", "Column1", Splitter.SplitTextByDelimiter("- ", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", Percentage.Type}})
in
    #"Changed Type"

 

View solution in original post

3 REPLIES 3
erik_tarnvik
Solution Specialist
Solution Specialist

Remove top three lines (or four, hard to tell from picture) and then split column delimited by "- ". That would generate the M code below.

 

let
    Source = Table.FromColumns({Lines.FromBinary(File.Contents("C:\testdata.txt"), null, null, 1252)}),
    #"Removed Top Rows" = Table.Skip(Source,3),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Top Rows", "Column1", Splitter.SplitTextByDelimiter("- ", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", Percentage.Type}})
in
    #"Changed Type"

 

thanks ill give it a bash.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




If you dont want the first column but only the percentages you can delete it in the query editor of course.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors