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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Henrik_99
Resolver I
Resolver I

Rolling by Week

Hi

 

I am trying to create a rolling sum between Monday and Sunday as shown below in column "Rolling earned". How do you calculated this value. 

 

Capture.JPG

 

Earned week is calculated as following:

Rolling Earned Week = CALCULATE([Earned2],    FILTER (
        ALL ( 'DateTable'[EoWDate] ),
        YEAR ( 'DateTable'[EoWDate]) = YEAR ( MAX ('DateTable'[EoWDate] ) )
            && 'DateTable'[EoWDate] <= MAX ( 'DateTable'[EoWDate] )
    )
)
 
Henrik

 

 

 

1 ACCEPTED SOLUTION
Henrik_99
Resolver I
Resolver I

Excellent, working fine.

 

Thank you, Mikelytics...;)

View solution in original post

3 REPLIES 3
Henrik_99
Resolver I
Resolver I

Excellent, working fine.

 

Thank you, Mikelytics...;)

mangaus1111
Solution Sage
Solution Sage

Hi @Henrik_99 ,

maybe this works for you

Measure = 
VAR MinDate = MIN('Facts8'[Date])
VAR MaxWeek = MAX('Facts8'[Week])
RETURN
SUMX(
     FILTER(
          ALL('Facts8'),
           MaxWeek = 'Facts8'[Week] && MinDate >='Facts8'[Date]
           ),
    'Facts8'[Earned]
)

this is the table that I have used

mangaus1111_0-1666964780411.png

and this is the result

mangaus1111_1-1666964827457.png

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Mikelytics
Resident Rockstar
Resident Rockstar

Hi Henrik,

 

I have another approach which looks a little bit more complex in the first place but it also covers the correct calculation when the year changes if this is a requirement in your case:

 

 

 

Rolling weeks incl change of year = 
var var_EndDate = MAX('Dim Date'[Date])
var var_WeekDayNumber = CALCULATE(SELECTEDVALUE('Dim Date'[WeekDayNum]),'Dim Date'[Date] = var_EndDate)
var var_StartDate = var_EndDate - var_WeekDayNumber + 1

var Result =
CALCULATE(
    SUM(FactOnlineSales[SalesAmount]),
    ALL('Dim Date'),
    DATESBETWEEN('Dim Date'[Date],var_StartDate,var_EndDate)
)

RETURN
Result

 

 

 

Please find below the result.

 

Mikelytics_1-1666963663697.png

 

Best regards

Michael

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your kudos.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.