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 August 31st. Request your voucher.

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
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.