How to get last hourmeter reading from a mach...

How to get last hourmeter reading from a machine?

Have a table with columns A - timestamp B - placa (machine code) C - hourmeter D - last hourmeter

When inserting a new entry, the hourmeter canยดt be smaller than the last hourmeter inserted.

So I need to get the last hourmeter, and if itโ€™s higher than the one inserted, it will block the insertion of the new one (needs to type a new number)

tried this function at Last Hourmeter column LOOKUP(maxrow(app, timestamp), app, placa, hourmeter)

Got error message saying the result type was a number, when it expected a text.

What should I use in place?

0 5 347
5 REPLIES 5

[_THIS]>MAX(SELECT(TableName[HOURMETER],[PLACA]=[_THISROW].[PLACA]))

Thanks Aleksi, the formula works, but I would still like to SHOW to the operator what was the previous hourmeter.

And by using โ€œMAX(SELECT(TableName[HOURMETER],[PLACA]=[_THISROW].[PLACA]))โ€ on the โ€œLast Hourmeterโ€ column, I also get the message that the result (number) does not matches the expected type (text)

I find it funny that itโ€™s result canยดnt be shown and yet the same result is valid and used when comparing which one is larger, in your expression!

Is the Last Hourmeterโ€™s column type a number? The error message is saying that the result is a number but your column is waiting for a text value.

Wellโ€ฆ when I wrote this topic, and when I replied above, I checked 3 times and the column was a NUMBER type. I even changed on purpose to TEXT type just to be sure the inverse wouldnยดt work (it did not)

Now I went there and changed again to number typeโ€ฆ and it workedโ€ฆ

Good to hear itโ€™s working now.

Top Labels in this Space