This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA 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.
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] ) )
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.
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 26 | |
| 25 | |
| 22 | |
| 13 |
| User | Count |
|---|---|
| 60 | |
| 50 | |
| 26 | |
| 20 | |
| 19 |