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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
jimpatel
Post Patron
Post Patron

3 m rolling

Hi,

 

Thanks for looking at my post.

 

I got stuck with 3 months rolling formula and any help will be much appreciated.

 

I have data and i wanted to sum the rolling 3 months please. 

In this instance in below data, 

 

3M rolling for Mar 2024 will be 35 ( 30 + 3 +2)

3M rolling for Feb 2024 will be 30 (3+2+25)

3M rolling for Jan 2024 will be 27 (0+25+2) and so on....

 

Data snapshot:

 

jimpatel_0-1714471099945.png

 

3m rolling which is wrong:

jimpatel_1-1714471131119.png

 

Formula used for 3m rolling :

jimpatel_2-1714471150076.png

 

any idea please?

 

thanks a lot

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

Thanks for the reply from @aduguid , please allow me to provide another insight:

 

Hi  @jimpatel ,

Here are the steps you can follow:

1. Create measure.

Value =
IF(    MAX('Table'[Date])=MINX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Date]),
    SUMX('Table',[Total]),0)
3 m rolling =
var _enddate=EOMONTH(MAX('Table'[Date]),0)
var _startdate=EOMONTH(MAX('Table'[Date]),-3)
RETURN
SUMX(
    FILTER(ALL('Table'),
    'Table'[Date]>=_startdate&&'Table'[Date]<=_enddate),
[Value])

2. Result:

vyangliumsft_0-1714542165263.png

 

 

Best Regards,

Liu Yang

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

View solution in original post

9 REPLIES 9
jimpatel
Post Patron
Post Patron

Sorry for reopening this post.

May i know how to change below formula please.

 

* This formula is summing data if it is falling on same day. That is i wanted to take one value or average value if it is falling on same date please.  Any help will be highly appreciated.

 

Value =
IF(    MAX('Table'[Date])=MINX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Date]),
    SUMX('Table',[Total]),0)
Anonymous
Not applicable

 

Thanks for the reply from @aduguid , please allow me to provide another insight:

 

Hi  @jimpatel ,

Here are the steps you can follow:

1. Create measure.

Value =
IF(    MAX('Table'[Date])=MINX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Date]),
    SUMX('Table',[Total]),0)
3 m rolling =
var _enddate=EOMONTH(MAX('Table'[Date]),0)
var _startdate=EOMONTH(MAX('Table'[Date]),-3)
RETURN
SUMX(
    FILTER(ALL('Table'),
    'Table'[Date]>=_startdate&&'Table'[Date]<=_enddate),
[Value])

2. Result:

vyangliumsft_0-1714542165263.png

 

 

Best Regards,

Liu Yang

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

Sorry for reopening this post.

May i know how to change below formula please.

 

* This formula is summing data if it is falling on same day. That is i wanted to take one value or average value if it is falling on same date please.  Any help will be highly appreciated.

 

Value = IF( MAX('Table'[Date])=MINX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))),[Date]), SUMX('Table',[Total]),0)

 

The reason i found is , if 2 rows fall in the minimum criteria the code is adding those values. Is there anyway to not to do that pleasE?

 

jimpatel_0-1716300845495.png

 

Thanks a lot 

 

 

Perfect

 

Thanks a lot for your kind help 🙂

jimpatel
Post Patron
Post Patron

Any idea of where i am going wrong please?

 

Thanks a lot again

jimpatel
Post Patron
Post Patron

Much appreciated but i am getting below

jimpatel_0-1714478603466.png

 

May i know what i am doing wrong pleasE?

 

Thanks a lot

aduguid
Super User
Super User

 

RollingSum3Months = 
VAR CurrentDate = MAX('YourDateColumn')
RETURN
    CALCULATE(
        SUM('YourValueColumn'),
        DATESINPERIOD (
           Calendar[Date],
           LASTDATE ( PREVIOUSMONTH ( Calendar[Date] ) ),
           -3, MONTH
    )
    )

 

Thanks for your reply.

 

But i am still getting wrong answer. Am i doing anything wrong here pleasE?

 

I have used above formula in both column and measure and still no luck 😞

jimpatel_0-1714476166613.png

 

 

 

I've updated my answer. Hope this helps.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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