cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kroeterix
Frequent Visitor

How to return a specific record from a list using power query?

Hello,

 

I have created a list with 3 types of fruits {"apple", "banane", "blackberry"}. I have the function List.First to return the first record (apple) and the funktio List.Last to return the last record ("blackberry"). But how can I return the second, or thrid or Nth record of a list.

 

Thank you very much in advance!

 

Sammy

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Hey Sammy, you want to review this reference:

 

https://msdn.microsoft.com/en-us/library/mt299038.aspx

 

Specifically, the answer to your question is:

 

ListName{1}

 

Here is test M code:

 

let
    MyList = {"apple", "banana", "blackberry"},
    Output = MyList{1}
in
    Output

Lists are essentially zero-based arrays.


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

Hey Sammy, you want to review this reference:

 

https://msdn.microsoft.com/en-us/library/mt299038.aspx

 

Specifically, the answer to your question is:

 

ListName{1}

 

Here is test M code:

 

let
    MyList = {"apple", "banana", "blackberry"},
    Output = MyList{1}
in
    Output

Lists are essentially zero-based arrays.


@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.