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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shep123
Helper I
Helper I

Running 7 Day Total

I am trying to have a running total for the last 7 days. My table currently have Date and Value. I inserted a calculate column that I want to calculate the results for the previous 7 days. Since my table starts at 1/1 there will naturally be less than 7 days for the first 6 days of the year. However, beyond that I want to calculate the previous 7 day total based on only dates that fall in that range. So 1/7 would be all the values for 1/1 through 1/7 and 1/8 would be all the values for 1/2 through 1/8 and continuing on for the entire year. How can I accomplish this in DAX?

 

Date   Value   Running 7 Day

1/1      2           2

1/2      3           5

1/3      1           6

1/4      4           10

1/5      2           12

1/6      3           15

1/7      1           16

1/8      4           18

1/9      3           18

 

 

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

Use this MEASURE

 

7 Day RT MEASURE =
    CALCULATE (
        SUM ( Table1[Value] ),
        DATESINPERIOD ( Table1[Date], LASTDATE ( Table1[Date] ), -7, DAY )
    )

View solution in original post

1 REPLY 1
Sean
Community Champion
Community Champion

Use this MEASURE

 

7 Day RT MEASURE =
    CALCULATE (
        SUM ( Table1[Value] ),
        DATESINPERIOD ( Table1[Date], LASTDATE ( Table1[Date] ), -7, DAY )
    )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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