Skip to main content
Question

Running Total with a Max

  • December 23, 2025
  • 0 replies
  • 188 views

Forum|alt.badge.img+5

Have a timesheets table and it helps with accruing Paid time off.

I need to implement a policy that PTO will max out at 160 hours in a running total field. 

The running total field looks like this:

var text QONE = "{23.BF.'" & [Date] & "'}AND {56.EX.'"& [Related Resource] &"'}";
var text QTWO = "{23.EX.'" &[Date] & "'}AND{3.LTE.'" & [Record ID#] & "'}AND {56.EX.'"& [Related Resource] &"'}";

Min(160,Nz(SumValues(GetRecords($QONE),193)+Nz(SumValues(GetRecords($QTWO),193),0)))

THE PROBLEM: When I use the Min function  it doesnt calculate against the 160 value in the formula.  If the balance is 200 hours, any subsequent line entries build off the 200 value although the table above shows 160.  

Here is the table without the Min function:

When I try to change the formula in the PTO in the something like

If([PTO BALANCE]>=160,0,[Hours worked]*[PTO Rate] 

I get an error that I cannot write a formula for a field that is based on itself.

---------------------------------------------------------------------------

I also tried the pipeline approach but since PTO in is a calculated field I hit a road block as well.

 

 

MarkShnierYou
Forum|alt.badge.img+24

I'm not sure I completely understand why you need to queries to get to your totals, but maybe it has something to do with the placement of the brackets. Maybe try this

 

Min(

160,Nz(SumValues(GetRecords($QONE),193))+

 

Nz(SumValues(GetRecords($QTWO),193))

)

 


Forum|alt.badge.img+5
  • Author
  • Registered
  • December 26, 2025

The problem here is that when someone uses 8 hours of PTO is does not take it into account in the balance field. It still show a balance of 160 instead of 152.

  If there is a better way to do running totals without a query I'm all ears.