How to find the most recent log entry for each item?

Garin
New Member

I am creating an app that will display the current location of an instrument set (Tray_Number). Users enter in the date, Tray_number being used, location of the Tray_number is being used, and user who used the tray. This info is compiled into a log. How can I create a slice that looks at the log and returns the most recent entry for each Tray_Number?

I tried the following filter condition in the slice:
MAXROW(โ€œTray_Numberโ€, โ€œTimestampโ€)

This is returning all log entries. I would just like to see each Tray_Number listed with the information from the most recent time it was used. Any ideas?

Solved Solved
0 7 153
1 ACCEPTED SOLUTION

This:

(
  [_THISROW]
  = MAXROW(
    โ€œTray_Numberโ€,
    โ€œTimestampโ€,
    ([_THISROW].[Instrument ID] = [_Instrument ID])
    )
)

View solution in original post

7 REPLIES 7

Conditions always need a Yes/No result. MAXROW() returns a key value. Itโ€™ll probably work for you with this simple addition:

[_THISROW] = MAXROW(โ€œTray_Numberโ€, โ€œTimestampโ€)

Unfortunately this didnโ€™t work. It is still displaying all log entries.

Will?

What log are you talking about?
Lots of misunderstood data in your question (data-structure, relations)

Sorry, let me better describe what I am trying to do. I am creating an app that will keep track of when and where instruments are used. Each instrument has a unique ID. Users fill out a form (Timestamp, date, location, user, instrument ID) each time they use an instrument. The info is compiled into a table named โ€œLogโ€. Timestamp is used as the key for โ€œLogโ€

What I am trying to do is have a instrument status page that lists each instrument ID with its current location and user who is using said instrument. I have created a slice of โ€œLogโ€ that contains the timestamp, instrument ID, location, and user. I am trying to look up the row with the most recent timestamp for each instrument ID (Tray_Number), and then display this information. I tried using the following expression:

[_THISROW] = MAXROW(โ€œTray_Numberโ€, โ€œTimestampโ€)

This is returning the information for every entry into โ€œLogโ€. Does this clarification help?

This:

(
  [_THISROW]
  = MAXROW(
    โ€œTray_Numberโ€,
    โ€œTimestampโ€,
    ([_THISROW].[Instrument ID] = [_Instrument ID])
    )
)

This worked! Thank you!

Top Labels in this Space