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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
RD_PowerBI24
Helper I
Helper I

Rolling Month growth measure not working correctly

Hi All, 

 

I have a rolling sales column in my data set that adjust based on the selected rolling value, R3M, R6M, MAT.

 

However, the growth measure doesn't seem to add up. Here is the table for R3M sales & Monthly Volumes. 

 

YearMonthGrowthAll_Sales Rolling 3M AverageAll_Sales
2023January 202470202470
2023February 215690228910
2023March27.96%230155259085
2023April-4.39%235618218860
2023May4.69%249727271235
2023June28.41%257043281035
2023July-5.53%269503256240
2023August-13.59%260043242855
2023September-9.09%244012232940
2023October-5.28%235273230025
2023November4.90%235773244355
2023December6.07%239455243985
2024January-11.71%234692215735
2024February2.30%236442249605
2024March11.50%235293240540
2024April2.49%248658255830
2024May-10.65%237097214920

 

This is the code for the rolling average all_sales column:

 

All_Sales Rolling Average =
IF(
    ISFILTERED('All_Sales'[All_Invoice_Date]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    VAR __LAST_DATE = ENDOFMONTH('All_Sales'[All_Invoice_Date].[Date])
    VAR __DATE_PERIOD =
        DATESBETWEEN(
            'All_Sales'[All_Invoice_Date].[Date],
            STARTOFMONTH(DATEADD(__LAST_DATE, 'Dynamic Rolling Average'[Dynamic Rolling Average Value], MONTH)),
            __LAST_DATE
        )
    RETURN
        AVERAGEX(
            CALCULATETABLE(
                SUMMARIZE(
                    VALUES('All_Sales'),
                    'All_Sales'[All_Invoice_Date].[Year],
                    'All_Sales'[All_Invoice_Date].[QuarterNo],
                    'All_Sales'[All_Invoice_Date].[Quarter],
                    'All_Sales'[All_Invoice_Date].[MonthNo],
                    'All_Sales'[All_Invoice_Date].[Month]
                ),
                __DATE_PERIOD
            ),
            CALCULATE([All_Sales], ALL('All_Sales'[All_Invoice_Date].[Day]))
        )
)
 
'Dynamic Rolling Average'[Dynamic Rolling Average Value] is a negative numeric value that changes based on what is selected to amend the time period to look back on how the sales are calculated. The code above does this correctly if you sense check using the all_sales column on far right.
 
The growth code is here below, again using a dynamic rolling average value to calculate the growth on different time periods.
All_Sales MoM% =
IF(
    ISFILTERED('All_Sales'[All_Invoice_Date]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    VAR __PREV_MONTH =
        CALCULATE(
            [All_Sales],
            DATEADD('All_Sales'[All_Invoice_Date].[Date],'Dynamic Rolling Average'[Dynamic Rolling Average Value], MONTH)
        )
    RETURN
        DIVIDE([All_Sales] - __PREV_MONTH, __PREV_MONTH)
)
 
So on a R3M, this should be R3M May - R3M Feb/R3M Feb. (237097 - 236442)/236442 = 0.28%. Instead I get -10.65% and all sorts of other percentages in the table. Please can you let me know what is to be done here?
 
Thank you in advance.
4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @RD_PowerBI24 ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin Sheng, It didn't as I had already a calendar and date dimensions setup. I found another solution which helped specific to my situation.

parry2k
Super User
Super User

@RD_PowerBI24 

As a best practice, add a date dimension in your model and use it for time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools. Check the related videos on my YT channel

 

Add Date Dimension
Importance of Date Dimension
Mark date dimension as a date table - why and how?
Time Intelligence Playlist

 

Replace all the date column in your measures to date column from the date dimension and then test it.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thank you. Will take a look.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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