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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
LY18
Helper I
Helper I

Duplicate line based on a list contain in one column

Hi 

 

today i got a new issue 😉

 

i got a source table with information that are presented like this

ID MEASUREID_PARAMETERPARAMETER_NAMEEQT_CONCERNEDGroup_ValueGroup_SPEC
11PARAM1EQT1,EQT2,EQT350.45100
21PARAM1EQT1,EQT2,EQT350.69100
31PARAM1EQT1,EQT360.36100
42PARAM2EQT1,EQT47.350
52PARAM2EQT1,EQT510.8450
62PARAM2EQT5,EQT6,EQT910.450
72PARAM2EQT5,EQT6,EQT95.660
83PARAM3EQT1,EQT10,EQT97.510
93PARAM3EQT2,EQT54.610
103PARAM3EQT2,EQT32.310
113PARAM3EQT4,EQT102.550
123PARAM3EQT6,EQT754.650

 

In order to merge information by EQT and do some more calculation i would need to split the list of "EQT_CONCERNED" to get 1 line for each EQT (not split in column, but in rows ...) ... so for exemple line 1 should be transformed into 3 lines

 

11PARAM1EQT150.45

100

11PARAM1EQT250.45100
11PARAM1EQT350.45100

 

do you have some advise to do it in power bi query ?

 

thanks in advance for your help

 

regards

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @LY18 ,

 

Select the column and under Split Column -> By Delimiter -> Advanced options, you will see Split into rows option.

1.PNG2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @LY18 ,

 

Have your problem be solved? Please consider accept the answer as a solution if it worked.

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
v-jayw-msft
Community Support
Community Support

Hi @LY18 ,

 

Select the column and under Split Column -> By Delimiter -> Advanced options, you will see Split into rows option.

1.PNG2.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

smpa01
Super User
Super User

@LY18  Doable

 

 

let
    Source = Web.BrowserContents("https://community.powerbi.com/t5/Desktop/Duplicate-line-based-on-a-list-contain-in-one-column/m-p/927113#M444323"),
    #"Extracted Table From Html" = Html.Table(Source, {{"Column1", "DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > TR > :nth-child(1), DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > * > TR > :nth-child(1)"}, {"Column2", "DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > TR > :nth-child(2), DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > * > TR > :nth-child(2)"}, {"Column3", "DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > TR > :nth-child(3), DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > * > TR > :nth-child(3)"}, {"Column4", "DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > TR > :nth-child(4), DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > * > TR > :nth-child(4)"}, {"Column5", "DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > TR > :nth-child(5), DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > * > TR > :nth-child(5)"}, {"Column6", "DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > TR > :nth-child(6), DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > * > TR > :nth-child(6)"}}, [RowSelector="DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > TR, DIV[id='bodyDisplay'] > DIV.lia-message-body-content:nth-child(1) > TABLE:nth-child(6) > * > TR"]),
    #"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"ID MEASURE", Int64.Type}, {"ID_PARAMETER", Int64.Type}, {"PARAMETER_NAME", type text}, {"EQT_CONCERNED", type text}, {"Group_Value", type number}, {"Group_SPEC", Int64.Type}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Index",{"Index", "EQT_CONCERNED"}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Other Columns", "EQT_CONCERNED", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"EQT_CONCERNED.1", "EQT_CONCERNED.2", "EQT_CONCERNED.3"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"EQT_CONCERNED.1", type text}, {"EQT_CONCERNED.2", type text}, {"EQT_CONCERNED.3", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each {[EQT_CONCERNED.1],[EQT_CONCERNED.2],[EQT_CONCERNED.3]}),
    #"Merged Queries" = Table.NestedJoin(#"Added Index", {"Index"}, #"Added Custom", {"Index"}, "Added Custom", JoinKind.LeftOuter),
    #"Expanded Added Custom" = Table.ExpandTableColumn(#"Merged Queries", "Added Custom", {"Custom"}, {"Custom"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Added Custom",{"EQT_CONCERNED"}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Removed Columns", "Custom"),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Custom", each ([Custom] <> null))
in
    #"Filtered Rows"

 

 

weqa.PNG

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.