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
AdamWhittaker
Helper I
Helper I

Comma delimited fields split combine and filter in power query.

Hello, I am trying to figure out a way to split two fields via a comma, then add an index to each one then filter the first field to get one result and retrieve the same index from the 2nd command and then add the result of the 1st and 2nd column to new columns without effecting (duplicating the original list).

I have tried loads of different ways (like split list, addindexcolumn with select rows but it always fails on the 2nd part.

I have two columns.. IPAddress and MacAddress:

Example:

IPAddress

"127.0.0.1, 10.12.34.56, 169.254.23.56"

MacAddress

"12-FE-23-6D-14-A6,13-FE-23-6D-14-A6,14-FE-23-6D-14-A6"

 

Each IP address has an associated MAC and they follow the same order so 10.12.34.56's mac is 3-FE-23-6D-14-A6.

What i want to do is get the real IP and the MAC that belongs to that real IP and we can obviously get the IP by getting rid of the others with [IPAddress] <> "127.0.0.1" and [IPAddress] <> "192.168.0.1" and Text.Start([IPAddress], 😎 <> "169.254."). This would normally leave me with 1 ip address.

 

How would i go about getting the associated MAC? In my head i would write this to a temp table that becomes:

 

IP Address,        MAC,                              Index

127.0.0.1            12-FE-23-6D-14-A6       0

10.12.34.56        13-FE-23-6D-14-A6       1

169.254.23.56     14-FE-23-6D-14-A6      2

 

 

Then filter for the right ip get its index and then get the associated max via the index number.

 

Thanks for any help.

1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

let
    IP = "127.0.0.1, 10.12.34.56, 169.254.23.56",
    Mac = "12-FE-23-6D-14-A6,13-FE-23-6D-14-A6,14-FE-23-6D-14-A6",
    #"To Table" = Table.FromColumns(List.Accumulate({IP, Mac}, {}, (s,c) => s & {List.Transform(Text.Split(c, ","), Text.Trim)}), {"IP","Mac"}),
    #"Added Index" = Table.AddIndexColumn(#"To Table", "Index", 0, 1, Int64.Type)
in
    #"Added Index"

ThxAlot_0-1696450279409.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



View solution in original post

2 REPLIES 2
AdamWhittaker
Helper I
Helper I

Thanks @ThxAlot 

ThxAlot
Super User
Super User

let
    IP = "127.0.0.1, 10.12.34.56, 169.254.23.56",
    Mac = "12-FE-23-6D-14-A6,13-FE-23-6D-14-A6,14-FE-23-6D-14-A6",
    #"To Table" = Table.FromColumns(List.Accumulate({IP, Mac}, {}, (s,c) => s & {List.Transform(Text.Split(c, ","), Text.Trim)}), {"IP","Mac"}),
    #"Added Index" = Table.AddIndexColumn(#"To Table", "Index", 0, 1, Int64.Type)
in
    #"Added Index"

ThxAlot_0-1696450279409.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors