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

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

Reply
Daxtothemax
Helper I
Helper I

Previous Task ID Value IF Less Than

Looking for a DAX formula that would know if the previous day duration was less than the current day duration (meaning the duration increased). If it was true then take the previous day duration, if not take current day duration. 

 

Something along the lines of:

Calculated Remaining Duration= IF Earlier Task ID Remaining Duration is < Remaining Duration, Earlier Remaining Duration, Remaining Duration. 

 

Example below.

 

Daxtothemax_0-1652212214342.png

 

3 REPLIES 3
ryan_mayu
Super User
Super User

@Daxtothemax 

pls try this

Column = 
VAR _last=maxx(FILTER('Table','Table'[date]<EARLIER('Table'[date])&&'Table'[task id]=EARLIER('Table'[task id])),'Table'[date])
VAR _duration=maxx(FILTER('Table','Table'[date]=_last&&'Table'[task id]=EARLIER('Table'[task id])),'Table'[remining duration])
return if(ISBLANK(_duration)||'Table'[remining duration]<_duration,'Table'[remining duration],_duration)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @ryan_mayu 

Thank you, this works but the tasks can have multiple increases in Durations.  So I need the formula to reference the original first duration listed not just the previous date duration.  Any ideas? Thanks again!

@Daxtothemax 

is this what you want?

Column = 
var _first=minx(FILTER('Table','Table'[date]<=EARLIER('Table'[date])&&'Table'[taskid]=EARLIER('Table'[taskid])),'Table'[date])
return maxx(FILTER('Table','Table'[taskid]=EARLIER('Table'[taskid])&&'Table'[date]=_first),'Table'[remaining duration])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

Top Solution Authors
Top Kudoed Authors