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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
famousmouse
Regular Visitor

Using only DAX (not powerquery) drop duplicates based on a single column

I have a table similar to the following:-

 

idStatus Priority Created LastUpdated Resolved 
12345 open high 10/03/2025 23:58 12/03/2025 23:58 12/03/2025 23:58 
12346 openhigh 10/03/2025 23:58 12/03/2025 23:58 12/03/2025 23:58 
12345 open high 08/03/2025 23:58 09/03/2025 23:58 N/I 
12346 open low 07/03/2025 21:58 08/03/2025 23:58 N/I 
23456 open low 06/03/2025 20:58 07/03/2025 23:58 N/I 
31234openmed01/03/2025 23:5805/03/2025 23:58 05/03/2025 23:58 

 

I need to remove any rows where there is a duplicate on the "id" column, keeping only the top/highest row in the table. The final table should be:-

 

id Status Priority Created LastUpdated Resolved 
12345 open high 10/03/2025 23:58 12/03/2025 23:58 12/03/2025 23:58 
12346 open high 10/03/2025 23:58 12/03/2025 23:58 12/03/2025 23:58 
23456 open low 06/03/2025 20:58 07/03/2025 23:58 N/I 
31234 open med 01/03/2025 23:58 05/03/2025 23:58 

05/03/2025 23:58 

(Rows 4 & 5 have been removed as duplicates of rows 2 & 3)

 

I've tried using DISTINCT (Table and Column versions) and RANKX but can't seem to achieve the results I need.

 

Is this possible using only DAX in PowerBI? 

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@famousmouse First, create a calculated column to rank the rows based on the "id" column and any other criteria you want to use to determine the "top/highest" row. For example, you can use the "Created" date to determine the most recent entry.

 

RankColumn =
RANKX(
FILTER(
'YourTable',
'YourTable'[id] = EARLIER('YourTable'[id])
),
'YourTable'[Created],
,
DESC,
DENSE
)

 

Create a calculated table to remove duplicates

FilteredTable =
FILTER(
'YourTable',
'YourTable'[RankColumn] = 1
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

1 REPLY 1
bhanu_gautam
Super User
Super User

@famousmouse First, create a calculated column to rank the rows based on the "id" column and any other criteria you want to use to determine the "top/highest" row. For example, you can use the "Created" date to determine the most recent entry.

 

RankColumn =
RANKX(
FILTER(
'YourTable',
'YourTable'[id] = EARLIER('YourTable'[id])
),
'YourTable'[Created],
,
DESC,
DENSE
)

 

Create a calculated table to remove duplicates

FilteredTable =
FILTER(
'YourTable',
'YourTable'[RankColumn] = 1
)

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.