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
Antonio195754
Helper IV
Helper IV

Removing duplicates using DAX for Month over Month datasets

I have excel files a client is trying to summarize using PBI.  The current process is, each week a new file is produced, users goes to a column of "account IDs", removes duplicates and then they get the count of from another column, easy.  So they want a historical view and my thought was then to combine the tables, add a date column and respectively label that column by the date it was produced.  But now what i'm seeing is, if i remove dups in the query editor, i'm finding that the account ID could be and is the same from one file to another so the output is the last month is accurate, but the prior months have hardly any counts b/c the editor did what it was told to do, remove duplicates.  So my question is, how can i set up a measure that says something like "only remove duplicates per the month column, not the entire table."

 

Below is what the table looks like basically, where the output i'd like to see for december '21, after removing dups, the count is 5. And for november the count should be 6 but bc my query removes any duplicate as it should, the output shows 0.  Is there a way to make PBI filter by a column so that it doesn't remove all?

 

My plan B was to have the client remove duplicates in each file, then send over, that would certainly work.  But i'm trying to simplify this as much as possible if PBI has a way to do this.

 

account IDCount of valueDate 
1112-2021
2412-2021
2012-2021
1211-2021
2411-2021
2411-2021
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Antonio195754 ,

 

I think you can suggest your client to remove duplicates in Power Query first, then sum the count.

1.png

If they only want to calculate result by dax without transforming their table, you can try code as below to create a measure.

Sum count (Removing duplicates) = 
VAR _Removing_duplicates =
    SUMMARIZE (
        'Table',
        'Table'[account ID],
        'Table'[Count of value],
        'Table'[Date]
    )
RETURN
    SUMX ( _Removing_duplicates, [Count of value] )

Table:

2.png

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Antonio195754
Helper IV
Helper IV

To add, what client sends me is the file not massaged, so client doesn't remove duplicates. it's just the raw data where we were looking for PBI to do the heavy lifting. All client does is append the masterfile with new data and adds the date in the date column, and PBI picks it up from there.

Anonymous
Not applicable

Hi @Antonio195754 ,

 

I think you can suggest your client to remove duplicates in Power Query first, then sum the count.

1.png

If they only want to calculate result by dax without transforming their table, you can try code as below to create a measure.

Sum count (Removing duplicates) = 
VAR _Removing_duplicates =
    SUMMARIZE (
        'Table',
        'Table'[account ID],
        'Table'[Count of value],
        'Table'[Date]
    )
RETURN
    SUMX ( _Removing_duplicates, [Count of value] )

Table:

2.png

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors