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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ThomasWeppler
Super User
Super User

Removing duplicate rows based on three different columns

Hi Power BI community

I have a table called WorkPlanEntry with all the workday that are planned for a company.

My problem is that whenever a plan is edits the data added as a row in the table, but the old row is not deleted.
The table has three Columns
[User_id] (a number that indicate which user we are looking at.)
[Date] (is the date where the holiday is planned.)
[Unique_id] (a number that gets higher the later the the plan is added to the system.)

 

If a day is planned twice for the same [User_id] we should only look at the plan with the higehst [Unique_id] since its an edit. 

 

My Dax right now look like this 
Measure = COUNTROWS(RELATEDTABLE('WorkPlanEntry')

 

It adds all the rows togther but gets to many rows when I have the table has been edited.

 

Can anyone help me remove the extra rows?
All help that gets me closer to a solution is greatly appreciated

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@ThomasWeppler , You can try creating new calculated table

LatestWorkPlanEntry =
SUMMARIZE(
'WorkPlanEntry',
'WorkPlanEntry'[User_id],
'WorkPlanEntry'[Date],
"LatestUniqueID", MAX('WorkPlanEntry'[Unique_id])
)

This table will contain only the latest entries for each User_id and Date.

 




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

3 REPLIES 3
ThxAlot
Super User
Super User

From your description, it seems ([User_id], [Date]) can be used as "composite key"; thus

= COUNTROWS( SUMMARIZECOLUMNS( WorkPlanEntry[User_id], WorkPlanEntry[Date] ) )


Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



bhanu_gautam
Super User
Super User

@ThomasWeppler , You can try creating new calculated table

LatestWorkPlanEntry =
SUMMARIZE(
'WorkPlanEntry',
'WorkPlanEntry'[User_id],
'WorkPlanEntry'[Date],
"LatestUniqueID", MAX('WorkPlanEntry'[Unique_id])
)

This table will contain only the latest entries for each User_id and Date.

 




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

Proud to be a Super User!




LinkedIn






It worked like a charm. 
Thanks @bhanu_gautam for the quick answer.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.