Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Yon_Yamas
Regular Visitor

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

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

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")

View solution in original post

2 REPLIES 2
Yon_Yamas
Regular Visitor

Thank you so much !

FreemanZ
Super User
Super User

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")

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.