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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
blpaxson
New Member

Max Date by month and location

I need to identify which row of data was the last (END_DATE) in each month by IMPORT_CODE.  I would like to simply return on those rows the words "LAST" to allow me to use/filter the data for only those with the last data point.  End of Month and Days from last date I added but this seems inefficient.

 

blpaxson_0-1709307084092.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @blpaxson ,

You can create two calculated columns as below to get it:

YearMonth = FORMAT('Table'[END_DATE],"YYYYMM")
Column =
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table'[END_DATE] ),
        FILTER (
            'Table',
            'Table'[YearMonth] = EARLIER ( 'Table'[YearMonth] )
                && 'Table'[IMPORT_CODE] = EARLIER ( 'Table'[IMPORT_CODE] )
        )
    )
RETURN
    IF ( 'Table'[END_DATE] = _maxdate, "LAST" )

vyiruanmsft_0-1709529939500.png

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @blpaxson ,

You can create two calculated columns as below to get it:

YearMonth = FORMAT('Table'[END_DATE],"YYYYMM")
Column =
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table'[END_DATE] ),
        FILTER (
            'Table',
            'Table'[YearMonth] = EARLIER ( 'Table'[YearMonth] )
                && 'Table'[IMPORT_CODE] = EARLIER ( 'Table'[IMPORT_CODE] )
        )
    )
RETURN
    IF ( 'Table'[END_DATE] = _maxdate, "LAST" )

vyiruanmsft_0-1709529939500.png

Best Regards

amitchandak
Super User
Super User

@blpaxson , Based on what I got these blogs should help

 

Latest Date
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

 

Power BI Get the Last/Latest Value of a Category: https://www.youtube.com/watch?v=W4EF1f_k6iY

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors