Forum Discussion

cmilligan262's avatar
cmilligan262
Icon for Helper II rankHelper II
6 years ago
Solved

Find max date that record doesn't show up

I have a company roster that I pull every monday as well as the first and last day of every month. If someone's employee ID doesn't show up on the next roster I want to show a termination date of 1 day before the next roster entry.

 

For example:

Employee ID:   Name:                 Date of Roster:             Next Date of EID:

EID 1                Person 1              1/1/2020                      1/6/2020

EID 2                Person 2              1/1/2020                      1/5/2020

EID 3                Person 3              1/1/2020                      1/6/2020

EID 1                Person 1              1/6/2020                      

EID 3                Person 3              1/6/2020

 

Thank you for the help

  • try

     

    Employee next roster date = minx(filter(table,table[Employee ID]=ealier(table[Employee ID) && table[Date of Roster] >earlier(table[Date of Roster])),(table[Date of Roster]))
    next roster date = minx(filter(table,table[Date of Roster] >earlier(table[Date of Roster])),(table[Date of Roster]))
    terminate = if(isbalnk(table[Employee next roster date]),table[next roster date]-1,blank())

     

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
    Thanks. My Recent Blog -
    Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
    Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

    Connect on Linkedin

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi cmilligan262 ,

     

    Please refer to the Calculated Column below which is merged according to amitchandak's formula.

    Column = 
    var a = CALCULATE(MIN('Table'[Date of Roster]),FILTER('Table','Table'[Date of Roster]>EARLIER('Table'[Date of Roster])))
    var b = CALCULATE(MIN('Table'[Date of Roster]),FILTER('Table','Table'[Date of Roster]>EARLIER('Table'[Date of Roster])&&'Table'[Employee ID]=EARLIER('Table'[Employee ID])))
    return
    IF(ISBLANK(a),BLANK(),IF(ISBLANK(b),a-1,b))

     Result would be shown as below.

     

    Best Regards,

    Jay

    Community Support Team _ Jay Wang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • try

     

    Employee next roster date = minx(filter(table,table[Employee ID]=ealier(table[Employee ID) && table[Date of Roster] >earlier(table[Date of Roster])),(table[Date of Roster]))
    next roster date = minx(filter(table,table[Date of Roster] >earlier(table[Date of Roster])),(table[Date of Roster]))
    terminate = if(isbalnk(table[Employee next roster date]),table[next roster date]-1,blank())

     

    Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
    Thanks. My Recent Blog -
    Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
    Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

    Connect on Linkedin

    • cmilligan262's avatar
      cmilligan262
      Icon for Helper II rankHelper II

      What if I'm trying to do it as a calculated column in the table?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi cmilligan262 ,

         

        Please refer to the Calculated Column below which is merged according to amitchandak's formula.

        Column = 
        var a = CALCULATE(MIN('Table'[Date of Roster]),FILTER('Table','Table'[Date of Roster]>EARLIER('Table'[Date of Roster])))
        var b = CALCULATE(MIN('Table'[Date of Roster]),FILTER('Table','Table'[Date of Roster]>EARLIER('Table'[Date of Roster])&&'Table'[Employee ID]=EARLIER('Table'[Employee ID])))
        return
        IF(ISBLANK(a),BLANK(),IF(ISBLANK(b),a-1,b))

         Result would be shown as below.

         

        Best Regards,

        Jay

        Community Support Team _ Jay Wang

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.