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

View all the Fabric Data Days sessions on demand. View schedule

Reply
faint127
Frequent Visitor

Calculated Column grouped by Category and condition

Hey Guys

 

Im trying to create a Calculated Column (Calculated Date) that returns the last DateWithData, grouped by Product.

 

I can only manage to get min by Product

CALCULATE(min(Table1[DateWithData]), ALLEXCEPT(Product[ProductName]))

 

Any ideas?


Thanks in advance

Screenshot_1.jpg

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @faint127 ,

 

Here we go.

 

calculated date =
VAR currecntdate = [Data]
RETURN
    CALCULATE (
        MAX ( 'Table (2)'[datewithdata] ),
        FILTER (
            'Table (2)',
            'Table (2)'[Product] = EARLIER ( 'Table (2)'[Product] )
                && 'Table (2)'[Data] <= currecntdate
        )
    )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @faint127 ,

 

Here we go.

 

calculated date =
VAR currecntdate = [Data]
RETURN
    CALCULATE (
        MAX ( 'Table (2)'[datewithdata] ),
        FILTER (
            'Table (2)',
            'Table (2)'[Product] = EARLIER ( 'Table (2)'[Product] )
                && 'Table (2)'[Data] <= currecntdate
        )
    )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Greg_Deckler
Community Champion
Community Champion

Seems like you need something like this: https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/td-p/985814



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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