cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mooihoek Regular Visitor
Regular Visitor

Power BI Remove Duplcates based on measure value

I want to be able to remove some duplicate account numbers based on whether the account has expired or not.  I'm using the following measure to identify whether the acccount has expired in a table based in the account expiry date.

 

e.g. Account Expiry = DATEDIFF(TODAY(),MAX('Table1'[Account End Date]),DAY), this gives me a value in the Account Expiry Day column, I then want to remove 

 

As you can see by the below table, Account 2 appears twice, but only one is valid, e.g it has 10 days remaining (the other expired 35 days ago) . How can I remove the duplicates accounts which have expired?

 

Sales Account NameAccount Expiry (DaysAcount ExpiryAccount ID
Account 1-501/02/20181234
Account 2-351/05/201812345
Account 3-51/07/2018123456
Account 2101/08/201812345
Account 5151/09/201812345678
Account 6201/10/2018123456789

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Power BI Remove Duplcates based on measure value

Hi Mooihoek,

 

Check if the calculate column below is what you want to achieve.

捕获.PNG 

 

Regards,

Jimmy Tao

View solution in original post

8 REPLIES 8
Community Support Team
Community Support Team

Re: Power BI Remove Duplcates based on measure value

Hi Mooihoek,

 

You can create a measure using DAX as below:

Result = CALCULATE(MAX(Table1[Account Expiry(Days)]), ALLEXCEPT(Table1, Table1[Sales Account Name]))

捕获.PNG 

PBIX file: https://www.dropbox.com/s/v7dfs2j8yff3tg5/Power%20BI%20Remove%20Duplcates%20based%20on%20measure%20v....

 

Regards,

Jimmy Tao

Mooihoek Regular Visitor
Regular Visitor

Re: Power BI Remove Duplcates based on measure value

Many thanks Jimmy, doesnt appear to be working though, one thing that is different from your example is that my "Account Expiry" column is already a measure.  

 

 

Mooihoek Regular Visitor
Regular Visitor

Re: Power BI Remove Duplcates based on measure value

Can I create a new column from the Account Expiry measure?  

Community Support Team
Community Support Team

Re: Power BI Remove Duplcates based on measure value

Hi Mooihoek,

 

I have make a measure using Account Expiry(Days) column.

Account Expiry(Days) Measure = MAX(Table1[Account Expiry(Days)])

Then modify [Result] measure as below:

Result = CALCULATE([Account Expiry(Days) Measure], ALLEXCEPT(Table1, Table1[Sales Account Name]))

捕获.PNG 

 

Regards,

Jimmy Tao

Mooihoek Regular Visitor
Regular Visitor

Re: Power BI Remove Duplcates based on measure value

Thats great thanks, noticed through it only works if the Account Expiry hasnt been added to the table, and I need the column. Any ideas on how to get around this?

 

 

 Account Expiry.png

Community Support Team
Community Support Team

Re: Power BI Remove Duplcates based on measure value

Hi Mooihoek,

 

You should change [Account Expiry] as a column because calculate column can't based on aggregation value in DAX.

 

Regards,

Jimmy Tao

Highlighted
Mooihoek Regular Visitor
Regular Visitor

Re: Power BI Remove Duplcates based on measure value

How would I change Account Expiry (which is a measure) to a normal column? 

Community Support Team
Community Support Team

Re: Power BI Remove Duplcates based on measure value

Hi Mooihoek,

 

Check if the calculate column below is what you want to achieve.

捕获.PNG 

 

Regards,

Jimmy Tao

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 284 members 2,565 guests
Please welcome our newest community members: