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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
RRamirez01
Regular Visitor

Return the earliest date among a group using DAX

Hello Power BI Community,

 

I'm currently working on some DAX expressions to reduce the amount of rows in a data extract.

 

From the raw data, I get multiple records that use the same columns except from "Changed status date" column. So I created a concatenation to identify which are the group items that I need a unique value from (taking the earliest date) as follows. 

 

I want to keep only only row from each group.

 

NameInvoice #Invoice StatusChanged status DateConcatenation
Customer A1111Paid9/14/2022 4:23Customer A1111Paid
Customer A1111Paid7/26/2022 18:03Customer A1111Paid
Customer A1111Paid7/26/2022 18:03Customer A1111Paid
Customer B2222Paid9/14/2022 4:23Customer B2222Paid
Customer B2222Paid7/26/2022 18:03Customer B2222Paid
Customer B2222Paid7/26/2022 18:03Customer B2222Paid

 

I've seen in other posts that "VAR" was used but I can't create the VAR expression either by creating a new column in Field or Add column in Power Query Editor.

 

This is my first post, so I apologize if this inquiry has been answered in this Community.

 

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @RRamirez01 ,

 

I think you can try earliest function in table value field.

RicoZhou_0-1663234828044.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

3 REPLIES 3
Anonymous
Not applicable

Hi @RRamirez01 ,

 

I think you can try earliest function in table value field.

RicoZhou_0-1663234828044.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.

Syk
Super User
Super User

In Power Query select your time and you can use the date/time filters to select the earliest record

Syk_0-1663181544673.png


Based on your sample data, you will still have 2 records per invoice as they are exactly the same. You can select the little table in the top left of your data and click remove duplicates.

Syk_1-1663181626314.png

This will give you 1 row per invoice at the earliest status change date! 

 

Hi @Syk, thanks for your promptly answer. May be I should have claryfied this better, In my brief example, we only have the same date for an earliest result. But in the raw data I have several different dates that in each group (Given by the concatenation) so that means that I have one record only with the earliest date by each separate group.

 

To keep this as simple as possible, I changed only the "Customer B2222" date

 

NameInvoice #Invoice StatusChanged status DateConcatenation
Customer A1111Paid9/14/2022 4:23Customer A1111Paid
Customer A1111Paid7/26/2022 18:03Customer A1111Paid
Customer A1111Paid7/26/2022 18:03Customer A1111Paid
Customer B2222Paid8/14/2022 4:23Customer B2222Paid
Customer B2222Paid7/26/2022 18:03Customer B2222Paid
Customer B2222Paid7/26/2022 18:03Customer B2222Paid

 

I think this changes the resolution I might take here. 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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