Forum Discussion

Yon_Yamas's avatar
Yon_Yamas
Regular Visitor
2 years ago
Solved

Last middle last date

Hi,
My data base is like this and i would like to had a column filled with "First" when this is the first "date_debut" of the same group of "id_membre" ; "Last" if this is the last "date_début" of the group with same "id_membre" and "Renew" for the other rows.
Ex:
id_membre | date_debut  | new_row

1                 |  01/07/1965 | First

1                 |  01/07/1970 | Renew

1                 |  01/07/1971 | Last

2                 |  01/07/1965 | First

2                 |  01/08/1965 | Renew

2                 |  01/08/1965 | Renew

2                 |  01/08/1965 | Renew

2                 |  01/07/1965 | Renew

2                 |  01/07/1965 | Last

3                 |  01/07/1965 | First

4                 |  01/07/1965 | First

4                 |  01/07/1965 | Last

....

Tx for your help

  • hi Yon_Yamas ,

     

    try to add a calculated column like:

    column =
    VAR _table = FILTER(data, data[id_membre]=EARLIER(data[id_membre]))
    VAR _first = MINX(_table, data[date_debut])
    VAR _last = MAXX(_table, data[date_debut])
    RETURN
    SWITCH([date_debut], _first, "First", _last, "Last", "Renew")

2 Replies

  • hi Yon_Yamas ,

     

    try to add a calculated column like:

    column =
    VAR _table = FILTER(data, data[id_membre]=EARLIER(data[id_membre]))
    VAR _first = MINX(_table, data[date_debut])
    VAR _last = MAXX(_table, data[date_debut])
    RETURN
    SWITCH([date_debut], _first, "First", _last, "Last", "Renew")