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
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
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] ) )
)```
Highlighted
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.

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 284 members 2,671 guests
Recent signins: