Populating starting mileage with previous recorded mileage

Hello,

I am working through an app has the user enter the mileage at the start and end of day.
I’d like the starting mileage entry to be populated with the previous mileage for that truck.

I have 2 tables, Mileage Form and Trucks.

[Truck Number] from Mileage Form references [Truck ID] from Trucks. I can see the Related Mileage Forms in the Trucks table but I am still having trouble putting together the expression that will pull the previous recorded mileage for that truck in [Starting Mileage] located in the Mileage Form. Any help is greatly appreciated!

Mileage Form:

RowNumber
Record ID
Date
Truck Number → Ref
Starting Mileage
Ending Mileage
User

Trucks
Truck ID
Make
Year
Related Mileage Forms

Solved Solved
0 4 227
1 ACCEPTED SOLUTION

Hello Steve,

Please disregard today’s replies. I continued reading the very helpful thread you shared with me and was able to put together the expression that gave me the results I wanted!

LOOKUP(
MAX(
SELECT(
Mileage Tracker[_ROWNUMBER],
([_THISROW].[Truck Number] = [Truck Number])
)
),
“Mileage Tracker”,
“_ROWNUMBER”,
“Ending Mileage”
)

Thank you very much for all that you do!

  • Gus

View solution in original post

4 REPLIES 4

Steve
Platinum 4
Platinum 4

Thank you Steve for your guidance! I modified the formula above because the value I am trying to pull is not from another table but from the current table the form is adding rows to.

I was positive the expression below would work because the green check mark lights up but does not pull any value.

SELECT(
Mileage Tracker[Ending Mileage],AND([_ROWNUMBER] = MAX(Mileage Tracker[_ROWNUMBER]),([Truck Number] = [_THIS].[Truck Number]
)
)
What I believe the expression I put together above says:

Select the ending mileage where the row number is the max and the trucker number is equal to the truck number selected in the reference dropdown. I don’t know where the disconnect is or if I am missing a step in the expression? I will continue to troubleshoot but I’d be grateful for additional guidance.

Hello Steve,

Please disregard today’s replies. I continued reading the very helpful thread you shared with me and was able to put together the expression that gave me the results I wanted!

LOOKUP(
MAX(
SELECT(
Mileage Tracker[_ROWNUMBER],
([_THISROW].[Truck Number] = [Truck Number])
)
),
“Mileage Tracker”,
“_ROWNUMBER”,
“Ending Mileage”
)

Thank you very much for all that you do!

  • Gus

Well done!

Top Labels in this Space