cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AbbasG
Helper I
Helper I

Removing duplicates from the data

Hello People,

 

I have the data on the Power BI desktop. Where there are duplicate rows as below.

 

I need to remove the duplicates but want to keep the one with the minimum price.

 

I tried to remove the duplicates in the query editor, but it removes the one with minimum price.

ParticularDatePriceMerged
ABC10/8/2021$40.00ABC - $40.00
ABC10/11/2021$39.00ABC - $39.00

 

Any help will be appreciated!

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @AbbasG 

 

You can try this method.

First , sort Particular , then sort price by ascending. This is make sure the min price to be the first under the same Particular

And then use the remove duplicate row to remove. Because this remove duplicates rows will all ways keep the first one.

 

Or you can try dax to reach that. Try column like the following :

Column =
VAR _MIN =
    MINX(
        FILTER( 'Table', [Particular] = EARLIER( Table_DAX[Particular] ) ),
        [Price]
    )
RETURN
    IF( _MIN = [Price], 1, BLANK() )

 

And select the 1

vchenwuzmsft_0-1634198043401.png

 

 

I put the pbix file in the end you can reference.

 

Best Regards

Community Support Team _ chenwu zhu

 

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
v-chenwuz-msft
Community Support
Community Support

Hi @AbbasG 

 

You can try this method.

First , sort Particular , then sort price by ascending. This is make sure the min price to be the first under the same Particular

And then use the remove duplicate row to remove. Because this remove duplicates rows will all ways keep the first one.

 

Or you can try dax to reach that. Try column like the following :

Column =
VAR _MIN =
    MINX(
        FILTER( 'Table', [Particular] = EARLIER( Table_DAX[Particular] ) ),
        [Price]
    )
RETURN
    IF( _MIN = [Price], 1, BLANK() )

 

And select the 1

vchenwuzmsft_0-1634198043401.png

 

 

I put the pbix file in the end you can reference.

 

Best Regards

Community Support Team _ chenwu zhu

 

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

amitchandak
Super User
Super User

@AbbasG , refer if this topic can help

https://exceleratorbi.com.au/remove-duplicates-keep-last-record-power-query/

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

Power BI Dev Camp Session 22 with aka link 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!