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
JamesSPBI
New Member

Calculating Moving Range

Hi all, 

 

Need a little help with working this out please. 

 

Trying to calculate the moving range between a month and the previous month over a dataset (roughly 18 months). I have been using the below, but after testing it appears to be wrong.

MovingRange = ABS([Metric]-CALCULATE([Metric],PARALLELPERIOD(DateTable[StartOfMonthDate],-1,MONTH),ALL(DateTable)))
 
Any suggestions would be really appreciated!
1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@JamesSPBI , Try updating measure as

 

MovingRange =
VAR CurrentMetric = [Metric]
VAR PreviousMetric = CALCULATE(
[Metric],
PARALLELPERIOD(DateTable[StartOfMonthDate], -1, MONTH)
)
RETURN
ABS(CurrentMetric - PreviousMetric)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@JamesSPBI , Try updating measure as

 

MovingRange =
VAR CurrentMetric = [Metric]
VAR PreviousMetric = CALCULATE(
[Metric],
PARALLELPERIOD(DateTable[StartOfMonthDate], -1, MONTH)
)
RETURN
ABS(CurrentMetric - PreviousMetric)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






mickey64
Super User
Super User

To use the time intelligence functions, you must create a calendar table.

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.