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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
walker21
Frequent Visitor

Remove Duplicates

Hello,

I have a column called "name" and this column duplicates depending on what city they go to. I need to be able to delete the first row of the duplicates and keep the latest actions. I tried the below formula, which would give me the first date of the "name", but it will not change based on the week number of the year I choose. It always gives me the oldest record.

 

Show First Date = IF(
    CALCULATE(
        COUNTROWS(cr05d_table),
        FILTER(
            ALLEXCEPT(cr05d_table, cr05d_table[Name]),
            cr05d_table[Created On] < EARLIER(cr05d_table[Created On]))
    )
    >1,
    0,
    1
)
 
I need to show what the first date is when I filter by different weeks.
 
This is what I am hoping to achieve.
walker21_0-1682372539729.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, ensure that the column is formatted as Date/Time (since the entries in that column are lft aligned, it seems that the data type of the column is text).  Thereafter write this calculated column formula

Test = 1*(Data[created on]=calculate(min(Data[Created on])),filter(Data,Data[Created on]=earlier(Data[Created on])&&data[week number]=earlier(data[week number]))))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, ensure that the column is formatted as Date/Time (since the entries in that column are lft aligned, it seems that the data type of the column is text).  Thereafter write this calculated column formula

Test = 1*(Data[created on]=calculate(min(Data[Created on])),filter(Data,Data[Created on]=earlier(Data[Created on])&&data[week number]=earlier(data[week number]))))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ahmedx
Super User
Super User

Is this what you are looking for?
you can do it in power query

Screen Capture #925.png

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.