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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
cbruhn42
Helper III
Helper III

Return Earliest Date/Time Based on Calculated Column

I have the data set below and I'm determining the 'in Spec' column by comparing the Amount to the spec limit in a related column.  The column titled 'Column' is trying to return the earliest DT when in Spec column = 1.  This is the DAX I'm using:

 

MINX(FILTER('DCRS GC Data', 'DCRS GC Data'[in Spec] = 1 && EARLIER('DCRS GC Data'[VesselID])='DCRS GC Data'[VesselID]), 'DCRS GC Data'[DT])
 
I want to return 8/15/2024 20:30 for this example.

 

VesselIDDTAmountin SpecColumn
640078/13/2024 19:508408/13/2024 19:50
640078/14/2024 9:007008/13/2024 19:50
640078/14/2024 21:305408/13/2024 19:50
640078/15/2024 9:005108/13/2024 19:50
640078/15/2024 20:303518/13/2024 19:50
640078/19/2024 11:113518/13/2024 19:50
2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Your formula is not overly efficient but it returns the desired result

 

lbendlin_0-1726789548723.png

 

Here is a slightly better alternative with better sample data

 

lbendlin_1-1726789907221.png

 

 

View solution in original post

parry2k
Super User
Super User

@cbruhn42 or try this:

 

Earliest Date = 
CALCULATE ( 
    MIN ( 'Vessel'[DT] ),
    ALLEXCEPT ( 'Vessel', Vessel[VesselID] ),
    Vessel[in Spec] = 1 
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@cbruhn42 or try this:

 

Earliest Date = 
CALCULATE ( 
    MIN ( 'Vessel'[DT] ),
    ALLEXCEPT ( 'Vessel', Vessel[VesselID] ),
    Vessel[in Spec] = 1 
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

lbendlin_0-1726790448130.png

lbendlin_1-1726790539622.png

Looks like your query plan is better with fewer estimated rows but somehow my version is faster.

Edit: Never mind, I had not disabled the query cache.  Same run time, roughly.

lbendlin
Super User
Super User

Your formula is not overly efficient but it returns the desired result

 

lbendlin_0-1726789548723.png

 

Here is a slightly better alternative with better sample data

 

lbendlin_1-1726789907221.png

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.