Forum Discussion

Rigolleto's avatar
Rigolleto
Icon for Resolver I rankResolver I
7 years ago
Solved

Using M to show the last record

 

Hi,

I need to filter and show the last record from the list, I need to do it in power query using M, anybody can help!!!

 

  • Anonymous's avatar
    Anonymous
    7 years ago

    Rigolleto - You could Add a Custom Column that indicates whether the row equals the max index, like this:

    if [Index] = List.Max(#"Added Index"[Index]) then "Yes" else "No"

    Note: #"Added Index" is the name of the previous step in my case. You'll need to use the name of your previous step.

    Then, you can filter on your new column to only include "Yes".

    Hope this helps,

    Nathan

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    M does not have the concept of ordering of rows, so "last" is not working. I would say that you need a "max", and then you can click on the arrow, sort by value descending and the filter just one row

  • Anonymous's avatar
    Anonymous
    Not applicable

    Rigolleto - You could Add a Custom Column that indicates whether the row equals the max index, like this:

    if [Index] = List.Max(#"Added Index"[Index]) then "Yes" else "No"

    Note: #"Added Index" is the name of the previous step in my case. You'll need to use the name of your previous step.

    Then, you can filter on your new column to only include "Yes".

    Hope this helps,

    Nathan