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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Isidro
Helper IV
Helper IV

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
Zubair_Muhammad
Community Champion
Community Champion

Hi @Isidro

 

This shall get you the oldest invoice

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

Regards
Zubair

Please try my custom visuals

View solution in original post

Zubair_Muhammad
Community Champion
Community Champion

Hi @Isidro

This shall get you Most Recent Invoice

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

Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

Hi @Isidro

This shall get you Most Recent Invoice

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

Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad,

 

It is great!!!

 

Thank you and best regards.

Zubair_Muhammad
Community Champion
Community Champion

Hi @Isidro

 

This shall get you the oldest invoice

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

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.