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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors