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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
DemingPDCA
Helper I
Helper I

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
Super User
Super User

@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

@ 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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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