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! Learn more

Reply
Joorge_C
Resolver II
Resolver II

Running sum based on Date-1 and substracting a value based on the Date (working date or not)

Hello All, Im trying to replicate a cumulative formula based on a look up date prior to be able to substract, just like the excel below. Any ideas?

 

 

Thanks in advance!!!cummulative minus value.png

1 ACCEPTED SOLUTION

Thanks Cherie and all,

I have completed this via two things.

 

Created a metric to look up the previous week day value

Prev Work Day = CALCULATE(SUM('Dim DateCalendar'[Dim WorkDay.WorkingDay]),DATEADD('Dim DateCalendar'[Date],-1,DAY))

 

Created a Cumulative Sum formula

Running TSRGFM - IPD2T =
VAR MinDate =CALCULATE(MIN('Dim DateCalendar'[Date]), ALLSELECTED('Dim DateCalendar'))
VAR MaxDate =CALCULATE(MAX('Dim DateCalendar'[Date]), ALLSELECTED('Dim DateCalendar'))
VAR DateRange=FILTER(ALL('Dim DateCalendar'), 'Dim DateCalendar'[Date].[Date]>= MinDate && 'Dim DateCalendar'[Date].[Date] <=MaxDate)
RETURN
[TotSRGoal4Mnth & InspPerD2Tgt]-
    SUMX(FILTER(
        SUMMARIZE(DateRange,'Dim DateCalendar'[Date],
            "Value", MonthViewInspectionDemand[Insp Per Day to target],
            "TDATE", MIN('Dim DateCalendar'[Date]))
                , [TDATE] <= MAX('Dim DateCalendar'[Date])
                ),
        MonthViewInspectionDemand[Insp Per Day to target]*[Prev Work Day]
        )

View solution in original post

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Joorge_C

 

You may try  to create a column to get the values as requested. For example:

Column  =
SUMX (
    FILTER (
        Table1,
        Table1[Date]
            <= EARLIER ( Table1[Date] ) - 1
            && RELATED ( 'Calendar'[Workday] ) = 1
    ),
    Table1[Values]
)

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Cherie and all,

I have completed this via two things.

 

Created a metric to look up the previous week day value

Prev Work Day = CALCULATE(SUM('Dim DateCalendar'[Dim WorkDay.WorkingDay]),DATEADD('Dim DateCalendar'[Date],-1,DAY))

 

Created a Cumulative Sum formula

Running TSRGFM - IPD2T =
VAR MinDate =CALCULATE(MIN('Dim DateCalendar'[Date]), ALLSELECTED('Dim DateCalendar'))
VAR MaxDate =CALCULATE(MAX('Dim DateCalendar'[Date]), ALLSELECTED('Dim DateCalendar'))
VAR DateRange=FILTER(ALL('Dim DateCalendar'), 'Dim DateCalendar'[Date].[Date]>= MinDate && 'Dim DateCalendar'[Date].[Date] <=MaxDate)
RETURN
[TotSRGoal4Mnth & InspPerD2Tgt]-
    SUMX(FILTER(
        SUMMARIZE(DateRange,'Dim DateCalendar'[Date],
            "Value", MonthViewInspectionDemand[Insp Per Day to target],
            "TDATE", MIN('Dim DateCalendar'[Date]))
                , [TDATE] <= MAX('Dim DateCalendar'[Date])
                ),
        MonthViewInspectionDemand[Insp Per Day to target]*[Prev Work Day]
        )

Helpful resources

Announcements
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!

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