cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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] ) )
)

View solution in original post

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] ) )
)

View solution in original post

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] ) )
)

View solution in original post

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] ) )
)

View solution in original post

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.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

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

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

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.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

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

Users Online
Currently online: 45 members 879 guests
Please welcome our newest community members: