Forum Discussion

andrewhann's avatar
andrewhann
Icon for Helper II rankHelper II
8 years ago
Solved

LAST DATE FROM FILTERED DATA

I am having trouble creating a last date from filtered data from QA Test results so that I can compare dates and select results only from the last test done:

 

My date looks like this:

 

TRREF_TRVTRDATE_TRVQSCHARTCATTRVALUEQASPEC_TRVQSVER_TRVTRPASS_TRVLatest TRDATE_TRV
P/71621112/07/2017 13:34Q3384.4471808_QC1N12/07/2017 13:34
P/71621117/07/2017 03:09Q3382471808_QC1Y17/07/2017 03:09

 

I am filtering by QASPEC_TRV and QSCHARTCAT and end up with these two results. I want to see only the last test result (ie 17/07/2017) You can see that my attempt at latest date brings the last date for the row not for all the rows.

 

I want 17/07/2017 against both rows so that I can test if it is the last date and filter on that.

 

Any help appreciated.

  • Hi andrewhann,

     

    The formula below should work in this new scenario. :smileyhappy:

    Latest TRDATE_TRV =
    CALCULATE (
        MAX ( Table1[TRDATE_TRV] ),
        ALLEXCEPT ( Table1, Table1[TRREF_TRV], Table1[QASPEC_TRV], Table1[QSCHARTCAT] )
    )

     

    Regards

5 Replies

  • v-ljerr-msft's avatar
    v-ljerr-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi andrewhann,

     

    Based on my test, you should be able to use the formula below to create a new measure to calculate the selected Latest TRDATE_TRV in your scenario. :smileyhappy:

    Latest TRDATE_TRV = CALCULATE(MAX(Table1[TRDATE_TRV]),ALLSELECTED(Table1))

    Remark: you will need to replace 'Table1' with your real table name.

     

     

    Regards

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

      Thank you for that - it works perfectly as requested.

       

      One further extension required - I need the last date for each TRREF for multiple TRREFs:

       

      TRREFTRDATEQSCHARTCATTRVALUEQASPEC_TRVLatest TRDATE_TRV 
      P/71620208/08/2017 07:09Q3382.82471808_QC31/08/2017 10:3508/08/2017 07:09
      P/71735104/08/2017 01:33Q3382.4471808_QC31/08/2017 10:3504/08/2017 01:33
      P/71735204/08/2017 01:33Q3382.26471808_QC31/08/2017 10:3504/08/2017 01:33
      P/71735307/08/2017 15:45Q3381.49471808_QC31/08/2017 10:3507/08/2017 15:45
      P/71735404/08/2017 01:32Q3382.9471808_QC31/08/2017 10:3504/08/2017 01:32
      P/71735601/08/2017 08:43Q3385.6471808_QC31/08/2017 10:3508/08/2017 07:09
      P/71735608/08/2017 07:09Q3383.02471808_QC31/08/2017 10:3508/08/2017 07:09
      P/71735701/08/2017 12:17Q3385.2471808_QC31/08/2017 10:3504/08/2017 04:48
      P/71735704/08/2017 04:48Q3382.57471808_QC31/08/2017 10:3504/08/2017 04:48
      P/71785901/08/2017 16:50Q3384471808_QC31/08/2017 10:3508/08/2017 07:09
      P/71785908/08/2017 07:09Q3382.16471808_QC31/08/2017 10:3508/08/2017 07:09
      P/71786002/08/2017 16:48Q3384.6471808_QC31/08/2017 10:3508/08/2017 07:09
      P/71786008/08/2017 07:09Q3382.07471808_QC31/08/2017 10:3508/08/2017 07:09
             

       

      So that I can then filter for the last test for each TRREF where TRDATE = LatestTRDATE

       

      Thank you in advance for your help.

      • v-ljerr-msft's avatar
        v-ljerr-msft
        Icon for Microsoft Employee rankMicrosoft Employee

        Hi andrewhann,

         

        The formula below should work in this new scenario. :smileyhappy:

        Latest TRDATE_TRV =
        CALCULATE (
            MAX ( Table1[TRDATE_TRV] ),
            ALLEXCEPT ( Table1, Table1[TRREF_TRV], Table1[QASPEC_TRV], Table1[QSCHARTCAT] )
        )

         

        Regards