Forum Discussion

anewsom's avatar
anewsom
Regular Visitor
4 years ago
Solved

Get child columns associated with a max value

I have a simple parent child one to many table relationship. I want to get columns associated with the most recent child. Example: Parent: ID, Name   Child: ID, ParentID, Date, Amount   I wan...
  • amitchandak's avatar
    4 years ago

    anewsom , new column in parent table

     

    Column =

    var _max = maxx(filter(child, child[parent] = parent[ID]), Child[Date] )

    return

    maxx(filter(child, child[parent] = parent[ID] && Child[Date] = _max ), child[Amount])