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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Super User
Super User

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
Super User
Super User

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors