Show latest event using timestamp

I have 2 tables A & B with 1-many relationship.

I created 2 views:

  1. A.view.lkml
  2. B.view.lkml

In models, I joined them:

explore: A {
  join: B  {
     relationship: one_to_many
     sql_on: ${A.receipt_id} = ${B.receipt_id} ;;
  }
}

I would like to show all data from table A and latest B.event using B.event_timestamp

But I am not sure how to do that. I get duplicated events in the table, but I only want to show the latest event.

Can someone shed some light?

0 1 193
1 REPLY 1

You would have to include a some kind of row_number dimension in your data model B and then use it in sql_on: … AND ${B.event_no} = 1

Alternatively, first create a derived table from table B that will already contain only the first event

Top Labels in this Space
Top Solution Authors