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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
TimPowerBi2
Frequent Visitor

Get the first date for a name over multiple rows

Hello Power BI Community!

 

I am trying to get the earliest and latest date for every name in a timeseries table. I want to do this through a calculated column so I can run further analysis on the results. It would be greatly appreciated to get some help!

 

Below are to examples:

Current situation

NameDate
Michael23-7-2023
Michael24-7-2023
Michael12-6-2023
Charles5-5-2023
Charles26-7-2023
Henk2-2-2023
Henk4-6-2023
Henk15-7-2023
Henk7-1-2023

 

Desired result

 

NameDateEarliest Latest
Michael23-7-202312-6-202324-7-2023
Michael24-7-202312-6-202324-7-2023
Michael12-6-202312-6-202324-7-2023
Charles5-5-20235-5-202326-7-2023
Charles26-7-20235-5-202326-7-2023
Henk2-2-20237-1-202315-7-2023
Henk4-6-20237-1-202315-7-2023
Henk15-7-20237-1-202315-7-2023
Henk7-1-20237-1-202315-7-2023
1 ACCEPTED SOLUTION
MBernalBI
Frequent Visitor

Hello!!

 

I hope that I can help you. I have created a calculated table. 

Desired result = 
SUMMARIZE(Tabla,  
Tabla[Name],
Tabla[Date],
"Earliest", CALCULATE(MIN(Tabla[Date]), ALLEXCEPT(Tabla,Tabla[Name])),
"Latest", CALCULATE(MAX(Tabla[Date]), ALLEXCEPT(Tabla,Tabla[Name]))
)

 

This is the result

 

MBernalBI_0-1690366964394.png

 

I hope that I have helped you.

 

View solution in original post

8 REPLIES 8
vibin_k
Frequent Visitor

you can create two column 

Latest =CALCULATE(MAX(Table[Date]),ALLEXCEPT(Table, Table[Name]))


Earliest =CALCULATE(MIN(Table[Date]),ALLEXCEPT(Table, Table[Name]))

you can get the required table 

MBernalBI
Frequent Visitor

Hello!!

 

I hope that I can help you. I have created a calculated table. 

Desired result = 
SUMMARIZE(Tabla,  
Tabla[Name],
Tabla[Date],
"Earliest", CALCULATE(MIN(Tabla[Date]), ALLEXCEPT(Tabla,Tabla[Name])),
"Latest", CALCULATE(MAX(Tabla[Date]), ALLEXCEPT(Tabla,Tabla[Name]))
)

 

This is the result

 

MBernalBI_0-1690366964394.png

 

I hope that I have helped you.

 

Thank you so much for the quick solution!

 

It works really well thank you. The only thing that is bugging me is that despite the name field having only unique values in the new custom table I can only create a many-to-many relationship between it and the original table.

 

Do you know why this is? 

Hi @TimPowerBi2 

 

Which fields are you using in the relationship? 

Hi @MBernalBI 

 

I am using the Name fields.

Hi @TimPowerBi2 

 

This occurs because the relationship between the Name fields is N:N. Table 1 shows N records for Michael and Table 2 also shows N records for Michael.

 

I would use Table 2 for future analysis, since if the relationship were established as N:N, there could be duplicate problems. It is also a bad practice in data modeling.

 

I hope tha it helps you and it's a good solution.

Thanks a lot, that makes perfect sense and will work with it from there! 

TimPowerBi2
Frequent Visitor

Apologies for the poor formatting upon uploading.....

 

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.