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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
TuqueLogic
Frequent Visitor

DAX getting MIN value from rows with same value in different column

Feel silly asking as this seems like it should be simple.

Looking to create a new column for a table that contains the Min 'Start Date' value for rows that have the same InitialResultID.
IE just dealing with one table and two cols within it.

Things that I've tried:
 CALCULATE(MIN(table[Start Date]), FILTER(table, TestBillingAgentTasks[InitialResultID])
 
CALCULATE(MIN(table[Start Date]), FILTER(table, TestBillingAgentTasks[InitialResultID]=table[InitialResultID]))

More, how do you effectively reference a current row value instead of using scalar for comparative expressions like what is used in the filter fuction?
I find this easier to do / find in the manual for all of Excel, Pandas, SQL... 

1 ACCEPTED SOLUTION
TuqueLogic
Frequent Visitor

EARLIER seems to do it:
 
CALCULATE(MIN(table[StartDate]), FILTER(tableTestBillingAgentTasks[InitialResultID]=EARLIER(table[InitialResultID])))

Here it states EARLIER refersto the previous 'table scan':
EARLIER - DAX Guide

Can someone point me to where I can understand better what table scans are, where in the code they are initiated, and by which types of functions?

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @TuqueLogic ,

 

A table scan examines each record in a table row by row to determine if they meet the specified conditions. There are two types of functions that trigger a table scan: filtering functions, such as FILTER, and iteration functions, such as SUMX. The initiation of a table scan is related to these functions, occurring when these functions are called and during the calculation of row context.

 

I also created simple example data.

TestBillingAgentTasks

vlinhuizhmsft_0-1739241940829.png

table

vlinhuizhmsft_1-1739241994652.png

Create two calculated columns, the former is used to get the same ID and the latter calculates the minimum date:

SameValue = LOOKUPVALUE('TestBillingAgentTasks'[InitialResultID],'TestBillingAgentTasks'[InitialResultID],'table'[InitialResultID])
MinValue = IF('table'[SameValue]<>0,CALCULATE(MIN('table'[Start Date]),FILTER('table','table'[SameValue]=EARLIER('table'[InitialResultID]))))

 

Result:

vlinhuizhmsft_2-1739242162785.png

 

If there is a relationship between the two tables, the following formula can also be used:

MinDate = CALCULATE(MIN('table (2)'[Start Date]),FILTER(ALLEXCEPT('table (2)','table (2)'[InitialResultID]),'table (2)'[InitialResultID]=RELATED('TestBillingAgentTasks(2)'[InitialResultID])))

 

Best Regards,
Zhu

 

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

TuqueLogic
Frequent Visitor

EARLIER seems to do it:
 
CALCULATE(MIN(table[StartDate]), FILTER(tableTestBillingAgentTasks[InitialResultID]=EARLIER(table[InitialResultID])))

Here it states EARLIER refersto the previous 'table scan':
EARLIER - DAX Guide

Can someone point me to where I can understand better what table scans are, where in the code they are initiated, and by which types of functions?

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.