Forum Discussion

Charlie42's avatar
Charlie42
Frequent Visitor
4 years ago
Solved

Filter a table to keep the last date

Helle everyone,

I have a table like that:

docValDate
doc1Val101/01/2022
doc1Val101/03/2022
doc2Val201/01/2022
doc2Val201/02/2022
doc3val301//02/2022

 

With a DAX function, I look for create a new column (or new table) to filter each row with the last date and to have this new table :

docValLast Date
doc1Val101/03/2022
doc2Val201/02/2022
doc3val301//02/2022

 

 

I look with LASTDATE but I'm not able to find a good (and working) solution.

 

Could you help me ?

 

Thank in advance

  • Charlie42  sure

    Table =
    FILTER (
        tbl,
        tbl[Date]
            = CALCULATE ( MAX ( tbl[Date] ), ALLEXCEPT ( tbl, tbl[doc], tbl[Val] ) )
    )
    

     

     

2 Replies

  • In Power Query group your doc and val by the maximum of date.

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    Charlie42  sure

    Table =
    FILTER (
        tbl,
        tbl[Date]
            = CALCULATE ( MAX ( tbl[Date] ), ALLEXCEPT ( tbl, tbl[doc], tbl[Val] ) )
    )