Forum Discussion

cevangelista's avatar
cevangelista
Frequent Visitor
8 years ago
Solved

Find the Latest Value

Hi there,

How can I find the latest value (Recruitment Stage)  for each ID number in the table below based on the Recruitment Stage date?

 

ID NoRecruitment StageRecruitment Stage Date
1LOO Issued14/05/2018
1LOO Accepted15/05/2018
4Medical Booked3/04/2018
3Medical Booked1/05/2018
3Medical Approved5/05/2018
5Medical Booked30/04/2018
5Medical Approved10/05/2018
5LOO Issued12/05/2018
5LOO Approved13/05/2018
7Phone Screen9/05/2018
7Medical Booked12/05/2018
11Site Referral14/05/2018
2Phone Screen2/05/2018
2Reference Checking9/05/2018
2Medical Booked12/05/2018

 

I would need the data to show this:

ID NoRecruitment StageRecruitment Stage Date
1LOO Accepted15/05/2018
4Medical Booked3/04/2018
3Medical Approved5/05/2018
5LOO approved13/05/2018

 

Thanks in advanced! :)

  • Hey,

     

    i created a calculated column using this DAX statement:

    Is Latest = 
    var currentIDNo = 'Table1'[ID No]
    var latestDate = 
    CALCULATE(
        MAX('Table1'[Recruitment Stage Date])
        ,FILTER(ALL('Table1')
            ,'Table1'[ID No] = currentIDNo
        )
    )
    return
    IF('Table1'[Recruitment Stage Date] = latestDate, TRUE(), FALSE()) 

    Here is a screenshot of the result (my assumptuon: the Recruitment Stage Date is of data type datetime or date). Please be aware that my table shows other dates, this is due some date formatting issues :-) but nevertheless I can use the statement on your table:

     

    This column can now be used to filter the table.

     

    Hopefully this is what you are looking for.

     

    Regards

    Tom 

8 Replies

  • Hey,

     

    i created a calculated column using this DAX statement:

    Is Latest = 
    var currentIDNo = 'Table1'[ID No]
    var latestDate = 
    CALCULATE(
        MAX('Table1'[Recruitment Stage Date])
        ,FILTER(ALL('Table1')
            ,'Table1'[ID No] = currentIDNo
        )
    )
    return
    IF('Table1'[Recruitment Stage Date] = latestDate, TRUE(), FALSE()) 

    Here is a screenshot of the result (my assumptuon: the Recruitment Stage Date is of data type datetime or date). Please be aware that my table shows other dates, this is due some date formatting issues :-) but nevertheless I can use the statement on your table:

     

    This column can now be used to filter the table.

     

    Hopefully this is what you are looking for.

     

    Regards

    Tom 

    • cevangelista's avatar
      cevangelista
      Frequent Visitor

      Thanks Sean

       

      It works except the date is all 31-Dec-18, did I type in something wrong?

       

      • Sean's avatar
        Sean
        Community Champion

        Can you post the measure formula you are using? Are you referencing the right date and in the right table?