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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
JW_van_Holst
Resolver IV
Resolver IV

Add element to list in a list of list

I want to add 4 to the list {5,6} and keep the others elements (lists) of the (outer) list

Source = {{1,2,3}, {5,6}, {12,13}}

//JW

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @JW_van_Holst 

Place the following M code in a blank query to see the steps.

let
Source = {{1,2,3}, {5,6}, {12,13}},
res_ = List.Transform(Source, each if _ = {5,6} then _ & {4} else _)
in
res_

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

1 REPLY 1
AlB
Super User
Super User

Hi @JW_van_Holst 

Place the following M code in a blank query to see the steps.

let
Source = {{1,2,3}, {5,6}, {12,13}},
res_ = List.Transform(Source, each if _ = {5,6} then _ & {4} else _)
in
res_

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors