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 d...
  • amitchandak's avatar
    6 years ago

    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.