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
analyst_guy
Regular Visitor

Help with power BI formula for finding earliest date per id

To some this must be rudimentary Power BI, I've crom from tableau where I understood table calcs muhc easier than I understand Calculate. If i could crack this nut wihtout having to add more fields to a table it'd be swell

 

I have a table with hundreds of ID's, Types and Dates. I have a number of calcs to build but if I can sort this one I'm confident I can build the rest. I want the earliest date, per ID, when the Type is 1.

Sample data

IDTypeDate
ABC12311/01/2024
ABC12312/05/2024
ABC12323/06/2024
DEF45634/01/2024
DEF45615/01/2024
DEF45616/03/2024
GHI78937/01/2024
GHI78928/06/2024
GHI78919/01/2024

 

I want a measure that returns

ABC1231/01/2024
DEF4565/01/2024
GHI7899/01/2024

 

Thanks in advance

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the replies from Ritaf1983 and muhammad_786_1.


Hi @analyst_guy ,

 

Based on the description of your problem, I realized your needs by creating the following measure:

  

 

EarliestDate = CALCULATE(MIN('Table'[Date]),ALLEXCEPT('Table', 'Table'[ID]))

 

The result is as follows:

vlinhuizhmsft_0-1727661237974.png

Best Regards,
Zhu
Community Support Team

 

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

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Thanks for the replies from Ritaf1983 and muhammad_786_1.


Hi @analyst_guy ,

 

Based on the description of your problem, I realized your needs by creating the following measure:

  

 

EarliestDate = CALCULATE(MIN('Table'[Date]),ALLEXCEPT('Table', 'Table'[ID]))

 

The result is as follows:

vlinhuizhmsft_0-1727661237974.png

Best Regards,
Zhu
Community Support Team

 

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

muhammad_786_1
Super User
Super User

Hi @analyst_guy 

 

You can use this measure to get the Earliest date.

 

EarliestDate = 
CALCULATE(
    MIN('Table'[Date]), 
    'Table'[Type] = 1
)

muhammad_786_1_0-1727435148248.png

 

Best Regards,
Muhammad Yousaf

 

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

 

LinkedIn

thank you, but I need the measure to work across each ID as well. I need to use this measure as a calc in subsequent calculations, and wihtout have to write ID = DEF456

analyst_guy
Regular Visitor

the measure should just have a date returned, thank you

Ritaf1983
Super User
Super User

Hi @analyst_guy 
Just to make sure that I understood you correctly, the desired result is a concatenated string in this format:
ABC1231/01/2024?
Or just the earliest date?

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.