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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
cbruhn42
Helper III
Helper III

Creating Control Charts - Moving Range Average Calculation

I'm trying to calculate the average moving range for one of my control charts and having trouble.

 

I found the code below to create a measure to calculate the moving range and this works.  However, I now need to calculate the average of these values to plot on my chart as the center line.  Any thoughts?

 

VAR EarlierTime =
CALCULATE (
MAX ( 'Final FV Alcolyzer Data (2)'[Alcolyzer DT] ),
FILTER (
ALLSELECTED ( 'Final FV Alcolyzer Data (2)'[Alcolyzer DT] ),
'Final FV Alcolyzer Data (2)'[Alcolyzer DT] < SELECTEDVALUE ( 'Final FV Alcolyzer Data (2)'[Alcolyzer DT] )
)
)
VAR EarlierMeasureValue =
CALCULATE ( SUM ( 'Final FV Alcolyzer Data (2)'[Value] ), 'Final FV Alcolyzer Data (2)'[Alcolyzer DT] = EarlierTime )
RETURN
IF(ISBLANK(EarlierMeasureValue), blank(), ABS ( EarlierMeasureValue - SUM ( 'Final FV Alcolyzer Data (2)'[Value] ) )

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @cbruhn42 

 

Assume that your current measure is called "Moving Range" and that you want to calculate the average of it over the x-axis field (I guess it is 'Final FV Alcolyzer Data (2)'[Alcolyzer DT]), you may try below measure

Average Measure =
VAR allValueTable =
    SUMMARIZE (
        ALLSELECTED ( 'Final FV Alcolyzer Data (2)'[Alcolyzer DT] ),
        "moving_range", [Moving Range]
    )
RETURN
    AVERAGEX ( allValueTable, [moving_range] )

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.