Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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 4
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
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?

Why do you want to do in Power Query.

Anonymous
Not applicable

Hello Arjunarao - Thank you for your reply.

I want to do it in query editor, since once i remove the old data rows, then the modified data set will be integrated alongwith other tables.

Current problem - I receive a new file with data only for a particular employee whose data has been changed but i cant delete the old data from the file itself. hence i want to remove the old data using query editor but at the same time preserve the data in input files.

 

can we put a counter which will give 1,2,3 basis the latest timestamp for each employee and reset itself to 1 for each new employee. that way, i can try to group records basis the max value for each employee

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.