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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RobRayborn
Helper IV
Helper IV

Show multiple rolling average % Diff

I've been asked to present the percentage difference in the rolling averages of Products Shipped vs Products Forecasted.
I need to be able to show by Product, and within the provided 2 year time frame, the percent differences at 3 month rolling, 6 month rolling, 9 month.....and ending at 24 month, and all instances of are to be shown. 

So far I've only been able to come up with six seperate DAX measures, one for each rolling month instance. 
One would think that there should be a better way. 

Below is an example of 3 month rolling average % difference measure I am using. For each instance I have been changing the name and the NumOfMonths amount.

 

3 Mo. Produc Rolling Avg % Diff =
VAR NumOfMonths = -3
VAR LastCurrentDate = MAX('Dates'[Date])
VAR Period = DATESINPERIOD('Dates'[Date], LastCurrentDate, NumOfMonths, MONTH)

VAR FC_RollingAvg =
CALCULATE(
AVERAGEX(
VALUES('Dates'[Month & Year]),
COALESCE([Product FC Total], 0)
),
Period
)

VAR Sales_RollingAvg =
CALCULATE(
AVERAGEX(
VALUES('Dates'[Month & Year]),
COALESCE('Orders Taken Measures'[Orders Taken], 0)
),
Period
)

VAR FirstDateInPeriod = MINX(Period, 'Dates'[Date])
VAR LastDateWithSales = MAX('BOI Orders Taken'[DATE_CREATED])

RETURN
IF(
FirstDateInPeriod <= LastDateWithSales,
DIVIDE(Sales_RollingAvg - FC_RollingAvg, FC_RollingAvg, 0)
)

3 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@RobRayborn,

 

You could try creating a parameter table with values 3, 6, 9, ... 24. Add this field to your visual and define the variable NumOfMonths as SELECTEDVALUE ( ParameterTable[Number of Months] ).





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

RobRayborn
Helper IV
Helper IV

Man you just saved me a heap of time. Thank you!

View solution in original post

Glad to hear that!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
RobRayborn
Helper IV
Helper IV

Man you just saved me a heap of time. Thank you!

Glad to hear that!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




DataInsights
Super User
Super User

@RobRayborn,

 

You could try creating a parameter table with values 3, 6, 9, ... 24. Add this field to your visual and define the variable NumOfMonths as SELECTEDVALUE ( ParameterTable[Number of Months] ).





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.