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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DemingPDCA
Helper II
Helper II

Cumulative Scrap Cost - Only show this year

I am trying to show cumulative scrap cost for only this year but my data has multiple years worth of information in it. I'm very close - and but its starting at the amount that I started the year with. I'd like to show this same thing, but have January 1 start at 0. I think my cumulative scrap formula must need another and statement? But I can't seem to get it right. 

Scrap Cost is the individual line items in my table, Scrap date is the day in that table that correlates to that cost, and calendar is just built out DAX Calendar 

 

Cumulative Scrap = 
CALCULATE(
    SUM(DMR_Scrap[ScrapCost]), FILTER(ALLSELECTED(DMR_Scrap), DMR_Scrap[ScrapDate Only] <= Max('Calendar'[Date]) && Date(2023, 1,1) <= Max('Calendar'[Date])))

 



DemingPDCA_0-1678990931095.png


Not sure this one is necessary to solve - but for reference!

 

Calendar = 
VAR 
    _startDate = EDATE(Today(), -14)
VAR
    _endDate = EDATE(TODAY(), 0)
RETURN
    ADDCOLUMNS(CALENDAR(_startDate, _endDate)
    , "Year", Year([Date])
    , "Year Month", YEAR([Date]) & " " & FORMAT([Date], "mmm")
    , "Quarter", "Q" & QUARTER([Date])
    , "Month Number", MONTH([Date])
    , "Month", FORMAT([Date], "mmm")
    , "Week", WEEKNUM([Date], 1)
    , "Year - Week", Year([Date]) & " " & WEEKNUM([Date])
    , "Day", Day([Date])
    , "Date Slicer"
        , IF([Date] = TODAY(), "Today"
            , IF([Date] = TODAY() - 1, "Yesterday"
            , FORMAT([Date], "mm/dd/yyyy") & ""
            )
        )
)

 

 

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@DemingPDCA Try:

Cumulative Scrap = 
CALCULATE(
    SUM(DMR_Scrap[ScrapCost]), FILTER(ALLSELECTED(DMR_Scrap), DMR_Scrap[ScrapDate Only] <= Max('Calendar'[Date]) && Date(2023, 1,1) <= Max('Calendar'[Date]))) + 0


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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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