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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
andrewhann
Helper II
Helper II

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.

1 ACCEPTED SOLUTION

Hi @andrewhann,

 

The formula below should work in this new scenario. Smiley Happy

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

 

Regards

View solution in original post

5 REPLIES 5
v-ljerr-msft
Employee
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. Smiley Happy

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

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

 

r1.PNG

 

Regards

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.

Hi @andrewhann,

 

The formula below should work in this new scenario. Smiley Happy

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

 

Regards

Perfect.

 

Thank you.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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