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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PSB
Helper III
Helper III

append columns

How can I combine S_Cell1, S_Cell2, S_Cell3 into one column S_Cell1,2,3 and keep the other related column data with it.

Example shown below in Before and After

 

1 ACCEPTED SOLUTION

@PSB This is a DAX calculated table. It is probably doable in Power Query as well, but that will take me a minute to figure out. Give me a few minutes.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
PSB
Helper III
Helper III

This is good solution. It will work but can it be done using tranformation in edit query?

or can this result be available in Edit Query window for applying more tranformations?

Sorry if I am not able to explain well. I'm new to Power BI.

@PSB OK, here is the Power Query code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("pY9BDsIwDAS/gnLuIet1nOTYK1L5QNX/f4M6AkoQiAgOtrJ2PF6va1gu52hVMUuYwnwXxLOSTsEVCNXiL+4htD2nUgmJYZs+YYEvSw6szynKEPaNv37JgW2OcxrHnm4BKoXeZ/R60rGTXyCSU+UDIs3dD06sxgZxlGn+D+K/LHfnbFc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [S_NodeId = _t, S_Cell1 = _t, S_Cell2 = _t, S_Cell3 = _t, T_gnb = _t, T_cid = _t, T_nRPCI = _t, T_nRTAC = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"S_NodeId", type text}, {"S_Cell1", type text}, {"S_Cell2", type text}, {"S_Cell3", type text}, {"T_gnb", Int64.Type}, {"T_cid", Int64.Type}, {"T_nRPCI", Int64.Type}, {"T_nRTAC", Int64.Type}}),
    Column1 = Table.RenameColumns(Table.SelectColumns(#"Changed Type", { "S_NodeId", "S_Cell1", "T_gnb", "T_cid", "T_nRPCI", "T_nRTAC"}),{{"S_Cell1", "S_Cell1,2,3"}}),
    Column2 = Table.RenameColumns(Table.SelectColumns(#"Changed Type", { "S_NodeId", "S_Cell2", "T_gnb", "T_cid", "T_nRPCI", "T_nRTAC"}),{{"S_Cell2", "S_Cell1,2,3"}}),
    Column3 = Table.RenameColumns(Table.SelectColumns(#"Changed Type", { "S_NodeId", "S_Cell3", "T_gnb", "T_cid", "T_nRPCI", "T_nRTAC"}),{{"S_Cell3", "S_Cell1,2,3"}}),
    AppendTables = Table.Combine( { Column1, Column2, Column3}),
    #"Filtered Rows" = Table.SelectRows(AppendTables, each ([#"S_Cell1,2,3"] <> " "))
in
    #"Filtered Rows"

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks! You are a Magician. 

@PSB This is a DAX calculated table. It is probably doable in Power Query as well, but that will take me a minute to figure out. Give me a few minutes.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@PSB Try:

Table 2 = 
FILTER(
    UNION(
        SELECTCOLUMNS('Table',"T_cid",[T_cid],"T_gnb",[T_gnb],"T_nRPCI",[T_nRPCI],"T_nRTAC",[T_nRTAC],"S_Cell1,2,3",[S_Cell1]),
        SELECTCOLUMNS('Table',"T_cid",[T_cid],"T_gnb",[T_gnb],"T_nRPCI",[T_nRPCI],"T_nRTAC",[T_nRTAC],"S_Cell1,2,3",[S_Cell2]),
        SELECTCOLUMNS('Table',"T_cid",[T_cid],"T_gnb",[T_gnb],"T_nRPCI",[T_nRPCI],"T_nRTAC",[T_nRTAC],"S_Cell1,2,3",[S_Cell3])
    ),
    [S_Cell1,2,3] <> BLANK()
)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

March 2024 PBI Gallery Image

Power BI Monthly Update - March 2024

Check out the March 2024 Power BI update to learn about new features.