cancel
Showing results for
Did you mean:
Member

## How calculate a column calculated with the year of the oldest invoice an another with the youngest

Hi,

I have the following table:

 CUSTOMER INVOICE DATE AAA 14/02/2014 BBB 14/06/2012 CCC 13/02/2016 AAA 15/03/2015 DDD 10/06/2013 EEE 20/12/2016 BBB 06/08/2013 CCC 22/09/2014 AAA 22/10/2016 BBB 14/11/2015

I want a column calculated with the year of the oldest invoice, and another column with the year of the most recent invoice.

 CUSTOMER INVOICE DATE OLDEST INVOICE MOST RECENT INVOICE AAA 14/02/2014 2014 2016 BBB 14/06/2012 2012 2015 CCC 13/02/2016 2014 2016 AAA 15/03/2015 2014 2016 DDD 10/06/2013 2013 2013 EEE 20/12/2016 2016 2016 BBB 06/08/2013 2012 2015 CCC 22/09/2014 2014 2016 AAA 22/10/2016 2014 2016 BBB 14/11/2015 2012 2015

Thank you very much and best regards.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User

## Re: How calculate a column calculated with the year of the oldest invoice an another with the younge

Hi @Isidro

This shall get you the oldest invoice

```=
CALCULATE (
YEAR ( MIN ( [INVOICE DATE] ) ),
FILTER ( Table1, Table1[CUSTOMER] = EARLIER ( Table1[CUSTOMER] ) )
)```
Super User

## Re: How calculate a column calculated with the year of the oldest invoice an another with the younge

Hi @Isidro

This shall get you Most Recent Invoice

```=
CALCULATE (
YEAR ( MAX ( [INVOICE DATE] ) ),
FILTER ( Table1, Table1[CUSTOMER] = EARLIER ( Table1[CUSTOMER] ) )
)```
3 REPLIES 3
Highlighted
Super User

## Re: How calculate a column calculated with the year of the oldest invoice an another with the younge

Hi @Isidro

This shall get you the oldest invoice

```=
CALCULATE (
YEAR ( MIN ( [INVOICE DATE] ) ),
FILTER ( Table1, Table1[CUSTOMER] = EARLIER ( Table1[CUSTOMER] ) )
)```
Super User

## Re: How calculate a column calculated with the year of the oldest invoice an another with the younge

Hi @Isidro

This shall get you Most Recent Invoice

```=
CALCULATE (
YEAR ( MAX ( [INVOICE DATE] ) ),
FILTER ( Table1, Table1[CUSTOMER] = EARLIER ( Table1[CUSTOMER] ) )
)```
Member

## Re: How calculate a column calculated with the year of the oldest invoice an another with the younge

It is great!!!

Thank you and best regards.