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

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

Reply
smpa01
Super User
Super User

Built in PQ function to add items at the end of the list?

Is there any PQ built in functionality that adds an item to the end of the list?

To elaborate, my initial list is following = {{1,2,3},{"A","B","C"}}

I want to add {1} at the end of the above list, I can currently do that by

 

let
    Source = {{1,2,3},{"A","B","C"}},
    Custom1 = List.InsertRange(Source,List.Count(Source),{1})
in
    Custom1

 

But, I want to avoid writing Custom1 if there is a built-in functionality, something like following 

 

let
    Source = {{1,2,3},{"A","B","C"}},
    Custom1 = List.addAtTheEnd(Source,{1})
in
    Custom1

 

where the function figures out where to add the item by iteslf on the funtion call itself rather then me pointing it at the index position in 

List.InsertRange(<list>, <index>, <values>)

 

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
1 ACCEPTED SOLUTION
Vera_33
Resident Rockstar
Resident Rockstar

Hi @smpa01 

 

I don't see a built-in one, but you can write one custom function like this

 

Vera_33_0-1635314888017.png

let
    Source = {{1,2,3},{"A","B","C"}},
    fxListaddAtTheEnd = (SourceList,newValue)=>List.InsertRange(SourceList,List.Count(SourceList),newValue),
    Custom1 = fxListaddAtTheEnd(Source,{1})
in
    Custom1

View solution in original post

1 REPLY 1
Vera_33
Resident Rockstar
Resident Rockstar

Hi @smpa01 

 

I don't see a built-in one, but you can write one custom function like this

 

Vera_33_0-1635314888017.png

let
    Source = {{1,2,3},{"A","B","C"}},
    fxListaddAtTheEnd = (SourceList,newValue)=>List.InsertRange(SourceList,List.Count(SourceList),newValue),
    Custom1 = fxListaddAtTheEnd(Source,{1})
in
    Custom1

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors