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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
RobinIrving
Regular Visitor

Remove duplicates - quite complex ask

Hello,

 

Tried copilot but cant quite get it right unfortunately. And read a few complex duplicate removeal threads on here but still no luck. 

 

Ive created dummy rows for my data as I need at least one for each month of the year. 

 

So I have the real row data for each resource in question - and appended this with my dummy rows. Thats all fine. Some of the real rows have two or three for one month. Others have one or none. 

 

I need to do the following. 

 

If any of the dummy rows already have any 'real' row in place for the same month - I want to remove them. If any do not have a real row in place for the same month - I want to keep them. FTE column shows the hours I am interested in. All the real rows have an actual number in them - not 0.00. All the dummy rows have 0.00.

 

Columns in question i need to use [There are other ones I will keep but they are not used in this calculation]

 

User:

MergedMonthNames:

FTE:

 

Co-Pilot gave M code for grouping rows and then working from that - but this isnt working. 

 

Table example below of what I have now and what I want to to result in. For the table there will be multiple resources that this should work for. Any help would be amazing !! Dummy rows are in red.

 

UserMergedMonthNamesFTE
DavidJanuary0.5
DavidJanuary0.5
DavidFebruary 1
DavidMarch1
DavidApril1
DavidJanuary0
DavidFebruary0
DavidMarch0
DavidApril0
DavidMay0
DavidJune0
DavidJuly0
DavidAugust0
DavidSeptember0
DavidOctober0
David

November

0
DavidDecember0

 

 

UserMergedMonthNamesFTE
DavidJanuary0.5
DavidJanuary0.5
DavidFebruary 1
DavidMarch1
DavidApril1
DavidMay0
DavidJune0
DavidJuly0
DavidAugust0
DavidSeptember0
DavidOctober0
David

November

0
DavidDecember0
1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@RobinIrving,

 

This solution uses a Power Query aggregation. The concept is a dummy row gets combined with an actual row without impacting the FTE column since adding zero doesn't change actual FTE amounts.

 

DataInsights_0-1739890393557.png

 

DataInsights_1-1739890410839.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
DataInsights
Super User
Super User

@RobinIrving,

 

This solution uses a Power Query aggregation. The concept is a dummy row gets combined with an actual row without impacting the FTE column since adding zero doesn't change actual FTE amounts.

 

DataInsights_0-1739890393557.png

 

DataInsights_1-1739890410839.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for that @DataInsights . I think this will work.

 

It will leave me with a table with only a few columns of what I require to do the calculations. However I think I can refer from my previous complete table to create this new table that has total FTE for each month for each resource.

 

If I then link these both my the unique resource I should be able to get my calculations to work. Will try tomorrow and hopefully sorts it out !  Cheers

@RobinIrving,

 

Here's a different approach that preserves all your columns.

 

1. Create table Real Rows (by reference to Original Table) and filter FTE <> 0:

 

DataInsights_0-1739918160561.png

 

2. Create table Dummy Rows To Keep (by reference to Original Table), filter FTE = 0, and use the Merge feature (left anti-join). Use Ctrl-Click to select multiple columns:

 

DataInsights_1-1739918409023.png

let
    Source = #"Original Table",
    FilterRows = Table.SelectRows(Source, each ([FTE] = 0)),
    MergeQueries = Table.NestedJoin(FilterRows, {"User", "MergedMonthNames"}, #"Real Rows", {"User", "MergedMonthNames"}, "Table", JoinKind.LeftAnti),
    RemoveColumn = Table.RemoveColumns(MergeQueries,{"Table"})
in
    RemoveColumn

 

DataInsights_2-1739918486024.png

 

3. Create table Final Table by using the Append feature to combine Real Rows and Dummy Rows To Keep:

 

DataInsights_3-1739918538254.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors