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

How to return a specific record from a list using M?

Hello,

 

lets say I have a list with three records {"apple", "orange", "banana"}. I can use the functions List.First and List.Last to return "apple" and "banana". However, how can I return the second or Nth record of a list?

 

Thank you very much in advance.

1 ACCEPTED SOLUTION
ImkeF
Super User
Super User

You can use List.Range for it.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Super User
Super User

You can use List.Range for it.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

This is exactly what I was looking for. Thank you Imke!

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.