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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Birdjo
Resolver II
Resolver II

Filter Report by Max Date

Hello,

I am working on a human resources report where I have to use the different positions. But when our employees edit the positions new row appears, while I only need the latest version of the records. 
I guess the Power Query can be modified to show only latest date per record but I don't know how.
worker.png


As you can see there are duplicate records. I would like to have the distinct values for WORKER while the MODIFIEDDATETIME is the latest.

Thank you in advance!

Kind Regards,
Birdjo

6 REPLIES 6
slava_k
Regular Visitor

You can use the "Group By" function  in Query Editor to get maxinum date by ID. If you need to keep the position field - you can load the table again and make inner join by ID and maximum date to grouped table.

I think a measure wont work. I need a table with the distinct values for WORKER where they are the latest by MODIFIEDDATE.


I've tried "Group By" Function and I got it the way I need, but when I add the other columns like "Personnel Number" and "Department" it becomes the same again.

 

Don't add the other columns, load the table again so you have 2 tables: 1 - agregated table with ID and max date, 2 - regular table with all the columns. Then join it with inner join by ID and max date.

 

 

With inner join I get the duplicates from the other table. Smiley Sad

Hi @Birdjo,

You can directly create a table visual by setting Latest for MODIFIEDDATETIME as shown in the following screenshot.
2.PNG1.PNG

If the above step doesn’t help, please share sample data of all columns in your table, and post expected result here.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Phil_Seamark
Employee
Employee

Hi @Birdjo

Here is a measure that might work

 

Last Worker = CALCULATE
				(MAX('Table3'[WORKER]),
				FILTER(
					'Table3',
					[MODIFIEDDATETIME]=MAX('Table3'[MODIFIEDDATETIME])
					)
				)

Or this will give you a 1 line table that you can build on

New Table = 
VAR 
    LastModifiedDate = MAX('Table3'[MODIFIEDDATETIME])
RETURN 
    FILTER(
        'Table3',
        'Table3'[MODIFIEDDATETIME]=LastModifiedDate
        )

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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