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! Request now

Reply
HansHansen
New Member

Cumulative Calculation of a Measure using dateadd

Hello,

I need support on calculating a cumulative sum of a measure that is using dateadd. Currently the cumulative measure does not start at the date that I want it to...

Let me describe my case:

  • I have a facts table containing values per day. Let's say the first value is from 1 August 2022
  • I create a measure that calculates a sum of the values.
  • I create another measure that shifts the values of this measure by certain days by using dateadd. Let's say, all values are shifted backwards for 7 days. This means, that the dateadd measure already starts on 25 July 2022 (= 7 days backwars from 1 August)
  • I then want to calculate a cumulative sum of the shifted values, HOWEVER that measure should only start calculation at the first day when there are also values for the initial measure.
    • In my case, the first value is on 1 August
    • The goal is to start cumulating the shifted values from that day onwards
    • The shifted value on 1 August is 487. This is the value that has been shifted from 8 August backwards for 7 days
  • Currently, the cumulative value of the shifted values starts at 25 July

 

The following picture contains my sample data, the measures and also the expected value:

 

Cumulative dateadd exampleCumulative dateadd example

 

 

Appreciated your comments on finding a solution 😉

 

Thanks!

Here are all measure that I have created

Value Sum = SUM(Data[Value])
Time shift in full days = CALCULATE(
    Roundup(AVERAGE(Data[Timeshift]),0),
    REMOVEFILTERS('Calendar')
    )
Value shifted by Days = 
    CALCULATE(
        [Value Sum],
        DATEADD(
            'Calendar'[Date],
            [Time shift in full days],
            DAY
        )
    )
Value shifted cumulated = CALCULATE(
    [Value shifted by Days],
    FILTER(
        ALL('Calendar'),
        'Calendar'[Date] <= MAX('Calendar'[Date])
    )    
)

 

2 REPLIES 2
Anonymous
Not applicable

Hi @HansHansen ,

 

Would you please share the data in text format so that we could test the formula?

 

Best Regrads,

Jay

Here is the sample data:

 

ItemDateValueTimeshift
A001.08.20224175
A002.08.20223124
A003.08.20222334
A004.08.20225744
A005.08.20221592
A006.08.20221138
A007.08.202255914
A008.08.2022952
A009.08.202218813
A010.08.20228421
A011.08.20227147
A012.08.2022444
A013.08.20223388
A014.08.20221545
A015.08.202261314
A016.08.20224533
A017.08.20226971
A018.08.20229638
A019.08.2022904
A020.08.202243312
A021.08.20224017
A022.08.20228768
A023.08.20223844
A024.08.202261911
A025.08.20228776
A026.08.202241914
A027.08.202218814
A028.08.202253310
A029.08.20222598
A030.08.202267613
A031.08.202288111
B101.08.202269712
B102.08.2022863
B103.08.202221217
B104.08.202267215
B105.08.20221817
B106.08.202253821
B107.08.2022767
B108.08.202299624
B109.08.202269620
B110.08.202218617
B111.08.202248922
B112.08.20222412
B113.08.202264823
B114.08.202219512
B115.08.202284018
B116.08.20229955
B117.08.20228627
B118.08.20229596
B119.08.20227694
B120.08.202240122
B121.08.20226917
B122.08.20225117
B123.08.202275721
B124.08.202223914
B125.08.20225368
B126.08.202232917
B127.08.202260924
B128.08.202252610
B129.08.202288813
B130.08.20224797
B131.08.20226723

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