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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
rodfernandez
Helper I
Helper I

Split Column into multiple Columns and Rows

 

Hello,
I am trying to extract information from my email, using the exchange connector.

I need to extract the information that comes in the column "Body.Text", currently the information comes in the following structure

SubjectDateBody.Text
Mail110-03-2021ID
NAME
NUMBER
TYPE
001
Rodrigo
1234
Type A
002
Joe
3853
Type C
Mail211-03-2021ID
NAME
NUMBER
TYPE
003
Jeff
9573
Type A
Mail306-02-2021ID
NAME
NUMBER
TYPE
004
Bob
2253
Type A
005
Andy
8862
Type B
006
Bart
3321
Type A


But I need to transform the data to something with this structure

SubjectDateIDNAMENUMBERTYPE
Mail110-03-2021001Rodrigo1234Type A
Mail110-03-2021002Joe3853Type C
Mail211-03-2021003Jeff9573Type A
Mail306-02-2021004Bob2253Type A
Mail306-02-2021005Andy8862Type B
Mail306-02-2021006Bart3321Type A

 

I have been trying to use the "Split Column" option but I have not been able to create the "Table 2"

I would be very grateful if you could support me with this problem

Thanks !



1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rZExD4IwEIX/iukMSXuVimOrDJLUGKKDIQwYwJAYa4gL/17qYB7gSNKh311e37trnjNbtg/BAiZ4yGVInDwc9qwIcjbchnPUNkG8WJNkUDhfT9jnXABlrurau4OKILlGdf+qV3qkJ6DU1UAyjuRUu/sW/BjkXxeLjYFOad00gNtoM8uhfzmkl6uQ0zI5cFvG3YCI5usYrzIC0s+qB4xjRVOxGYkVGpfdGz9CkvjjXHwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Subject = _t, Date = _t, Body.Text = _t]),
    #"Grouped by Subject" = Table.Group(Source, {"Subject","Date"}, {"ar", each _}, 0, (x,y) => Number.From(y[Subject]<>"")),
    Extracted = Table.TransformColumns(#"Grouped by Subject", {"ar", each let all=[Body.Text], hdr=List.FirstN(all,4), body=List.Split(List.Skip(all,4),4) in #table(hdr,body)}),
    #"Expanded ar" = Table.ExpandTableColumn(Extracted, "ar", {"ID", "NAME", "NUMBER", "TYPE"}, {"ID", "NAME", "NUMBER", "TYPE"})
in
    #"Expanded ar"

Screenshot 2021-05-24 205751.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

1 REPLY 1
CNENFRNL
Community Champion
Community Champion

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rZExD4IwEIX/iukMSXuVimOrDJLUGKKDIQwYwJAYa4gL/17qYB7gSNKh311e37trnjNbtg/BAiZ4yGVInDwc9qwIcjbchnPUNkG8WJNkUDhfT9jnXABlrurau4OKILlGdf+qV3qkJ6DU1UAyjuRUu/sW/BjkXxeLjYFOad00gNtoM8uhfzmkl6uQ0zI5cFvG3YCI5usYrzIC0s+qB4xjRVOxGYkVGpfdGz9CkvjjXHwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Subject = _t, Date = _t, Body.Text = _t]),
    #"Grouped by Subject" = Table.Group(Source, {"Subject","Date"}, {"ar", each _}, 0, (x,y) => Number.From(y[Subject]<>"")),
    Extracted = Table.TransformColumns(#"Grouped by Subject", {"ar", each let all=[Body.Text], hdr=List.FirstN(all,4), body=List.Split(List.Skip(all,4),4) in #table(hdr,body)}),
    #"Expanded ar" = Table.ExpandTableColumn(Extracted, "ar", {"ID", "NAME", "NUMBER", "TYPE"}, {"ID", "NAME", "NUMBER", "TYPE"})
in
    #"Expanded ar"

Screenshot 2021-05-24 205751.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors