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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

last date

Bonjour j'ai une table avec 2 colonnes, la première avec des dates de prestations et la deuxième avec des personnes. 

Les dates de prestations ne se suivent pas. je souhaiterais obtenir le nombre de jours entre la date de la ligne et la date inférieure existante par personne.

Ex dans le fichier joint, Pour obtenir la colonne Diff Last date à partir de date et Nom

 
DateNomDiff last date
01/07/2019Anull
02/07/2019A1
05/07/2019A3
01/07/2019Bnull
03/07/2019B2

Merci

2 ACCEPTED SOLUTIONS
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this code for a custom column:

 

Diff =
VAR _mindDate = CALCULATE(MIN('Table'[Date]), FILTER('Table', 'Table'[Nom] = EARLIER('Table'[Nom])))
RETURN DATEDIFF(_mindDate, 'Table'[Date], DAY)
 
Capture.PNG
 
 


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

AlB
Community Champion
Community Champion

Bonsoir @Anonymous 

Diff last date =
DATEDIFF (
    CALCULATE (
        MAX ( Table1[Date] ),
        ALLEXCEPT ( Table1, Table1[Nom] ),
        Table1[Date] < EARLIER ( Table1[Date] )
    ),
    Table1[Date],
    DAY
)

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Bonsoir @Anonymous 

Diff last date =
DATEDIFF (
    CALCULATE (
        MAX ( Table1[Date] ),
        ALLEXCEPT ( Table1, Table1[Nom] ),
        Table1[Date] < EARLIER ( Table1[Date] )
    ),
    Table1[Date],
    DAY
)

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this code for a custom column:

 

Diff =
VAR _mindDate = CALCULATE(MIN('Table'[Date]), FILTER('Table', 'Table'[Nom] = EARLIER('Table'[Nom])))
RETURN DATEDIFF(_mindDate, 'Table'[Date], DAY)
 
Capture.PNG
 
 


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.