cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Isidro Member
Member

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

Hi,

 

I have the following table:

 

CUSTOMERINVOICE DATE
AAA14/02/2014
BBB14/06/2012
CCC13/02/2016
AAA15/03/2015
DDD10/06/2013
EEE20/12/2016
BBB06/08/2013
CCC22/09/2014
AAA22/10/2016
BBB14/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.

 

CUSTOMERINVOICE DATEOLDEST INVOICEMOST RECENT INVOICE
AAA14/02/201420142016
BBB14/06/201220122015
CCC13/02/201620142016
AAA15/03/201520142016
DDD10/06/201320132013
EEE20/12/201620162016
BBB06/08/201320122015
CCC22/09/201420142016
AAA22/10/201620142016
BBB14/11/201520122015

 

Thank you very much and best regards.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
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] ) )
)
Highlighted
Super User
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
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] ) )
)
Highlighted
Super User
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] ) )
)
Isidro Member
Member

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

Hi @Zubair_Muhammad,

 

It is great!!!

 

Thank you and best regards.