The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a table similar to the following:-
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 |
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 |
31234 | open | med | 01/03/2025 23:58 | 05/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?
Solved! Go to Solution.
@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
)
Proud to be a 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
)
Proud to be a Super User! |
|
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
36 | |
14 | |
12 | |
7 | |
7 |