Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |