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

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

Reply
Anonymous
Not applicable

Sum of cost filtering minimum date (DAX)

Dear Team,

I need help to return the following,

 

For every Project Number in the table ,I want to calculate the sum of ‘Cost’ that has the minimum ‘Date’ present for that project number and a ‘Status’= L .

 

Project Number            Status             Date              Cost

        1                               L                12/4/2020        10

        1                               L                12/4/2020        10

        1                               L                12/18/2020        5

        1                               N                1/14/2020         8

 

I need to return, cost = 20 for Project Number 1 having a date 12/4/2020 &Status 'L'. Kindly suggest

 

 

4 REPLIES 4
ronbermudez
Helper I
Helper I

Thanks for helping me solve my long time problem.  The solution contained in this thread gave me a good clue to solve my own challenging DAX problem!

 

Thanks!

AlB
Community Champion
Community Champion

Hi @Anonymous 

1. Place Project Number in a table visual

2. Place this measure in the visual 

Measure =
CALCULATE (
    VAR lastDate_ =
        MIN ( Table1[Date] )
    RETURN
        CALCULATE ( SUM ( Table1[Cost] ), Table1[Date] = lastDate_ ),
    Table1[Status] = "L"
)

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

Anonymous
Not applicable

Hello AIB,

 

Thank you so much for your quick response. I did use the measure suggested and the table view returns no value. The project number is the unique key that drives Cost, Status and Date. Do we need to incorporate that in the query as well ?PBI.png

 Thanks in advance!

 

AlB
Community Champion
Community Champion

@Anonymous 

It's working on my side. See it all at work in the attached file.

You can also select the "L" on a slicer rather than having it hardcoded in the measure

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors