Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Filter out old data basis timestamp column

Hello All,

this is my first query on this website.

i have a data with following details (changes in data keep occuring and hence i would like to get a final table with most update data). this all operation i would like to achieve in query editor of Power Bi

EMP ID  EMP Name    Location             Timestamp
12345    Steve                 New York          21.05.2019 11:00:00
12345    Steve                 New Jersey       21.05.2019 11:05:00
23456    Mark                 New York           21.05.2019 11:00:00
34567    Ruby                 Los Angeles       21.05.2019 11:00:00
34567    Ruby                 Ohio                      21.05.2019 11:05:00

 

I would like to create a final table with only below rows as my final result

EMP ID  EMP Name    Location             Timestamp
12345    Steve                 New Jersey       21.05.2019 11:05:00
23456    Mark                 New York           21.05.2019 11:00:00
34567    Ruby                 Ohio                      21.05.2019 11:05:00

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hey Anonymous 

    You need to fetch the latest date according to the unique ID

    With Dax you can do something like

    Latest Date = CALCULATE(
        MAX('Table'[Timestamp]),
        ALLEXCEPT('Table','Table'[EMP ID])

    Where table is your table name.

     

    Then check what is your latest date

    isLatest = IF('Table'[Latest Date] = 'Table'[Timestamp],1,0)

    Filter where isLatest = 1

     

    Cheers!
    A

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello A, thank you for taking out time to reply. Since i am very new to Power BI, my question might feel silly.

      i am trying to filter old data in the query editor itself so that i can bring only latest data for my future calculations. how do i write your formula inside query editor?