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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Emma2
Frequent Visitor

First Expiry Date in a column

Can anyone help with getting a first expiry date from a column. 

 

I have data set as below:

 

Name             Document      Expiry Date

Name 1          Doc 1              07/09/2025

Name 1          Doc 2              18/09/2026

Name 1          Doc 3              24/05/2025

Name 2          Doc 1              15/08/2024

Name 2          Doc 2              30/11/2023

Name 3          Doc 3              25/01/2025

 

And so on - I need to extract the first expiry date per each name and it states the doc. 

 

Can anyone help please?

 

Thanks  

 

2 ACCEPTED SOLUTIONS

Hi @Emma2 

Please try below measure:

Exp date = CALCULATE(MIN('Table 1 (Pivot)'[Expiry Date]),ALLEXCEPT('Table 1 (Pivot)','Table 1 (Pivot)'[Name ]))

Uzi2019_1-1698745579686.png

 

after adding to the table set Doc to First like below setting

Uzi2019_2-1698745624973.png

 

If my post helps please give kudos and accept it as a solution!
thanks

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

View solution in original post

HI @Emma2 
If you just want to show n table you dont need to create any calculation just simply modify the aggregation like below
For Document to First

For expiry to Earliest

Uzi2019_3-1698745877086.png

 

see you will get the same desired result.

If my post helps please give kudos and accept it as a solution!
Thanks

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

View solution in original post

6 REPLIES 6
Uzi2019
Super User
Super User

Hi @Emma2 
Please share the expected outcome like how data should look like. 

Expiry date is expected output or input????

Name             Document      Expiry Date

Name 1          Doc 1              07/09/2025

Name 1          Doc 2              18/09/2026

Name 1          Doc 3              24/05/2025

Name 2          Doc 1              15/08/2024

Name 2          Doc 2              30/11/2023

Name 3          Doc 3              25/01/2025

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Emma2
Frequent Visitor

Hi,

 

The result should then look as to below; so I need only to be able to see the first expiry date with the document for each Name.

 

Name 1       Doc 3              24/05/2025
Name 2       Doc 2              30/11/2023

Name 3       Doc 3              25/01/2025

 

Thank you for your help.

Hi @Emma2 

Please try below measure:

Exp date = CALCULATE(MIN('Table 1 (Pivot)'[Expiry Date]),ALLEXCEPT('Table 1 (Pivot)','Table 1 (Pivot)'[Name ]))

Uzi2019_1-1698745579686.png

 

after adding to the table set Doc to First like below setting

Uzi2019_2-1698745624973.png

 

If my post helps please give kudos and accept it as a solution!
thanks

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

HI @Emma2 
If you just want to show n table you dont need to create any calculation just simply modify the aggregation like below
For Document to First

For expiry to Earliest

Uzi2019_3-1698745877086.png

 

see you will get the same desired result.

If my post helps please give kudos and accept it as a solution!
Thanks

Don't forget to give thumbs up and accept this as a solution if it helped you!!!
HotChilli
Super User
Super User

It's better to show the desired result when you post a question.

Do you want the name, earliest expiry and then the document from the row that matches that date?

If so,

put name in a table, drag the date in and aggregate with Earliest, then create a measure:

MeasureT = 
var _minDate = MIN(TableL[Expiry Date])
RETURN
CALCULATE (
    MIN ( TableL[Document]),
    KEEPFILTERS( TableL[Expiry Date] = _minDate )
)

Hi,

 

Thank you for you help. This works however only brings up 1 result.

 

I need to get the first expiry date for each name and stating the document.

 

So  if data was as below; I need to return the first doc to expire for Name 1, the first doc to expire for Name 2 and so on. 

 

Name             Document      Expiry Date

Name 1          Doc 1              07/09/2025

Name 1          Doc 2              18/09/2026

Name 1          Doc 3              24/05/2025

Name 2          Doc 1              15/08/2024

Name 2          Doc 2              30/11/2023

Name 3          Doc 3              25/01/2025

 

Thank you

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.