Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I hope that I can gain some advice on how to proceed in calculating a simple moving average with a period value depenant upon the variable parameter from a slicer.
The measure I currently have is as follows but the return is blank. The intention is to plot the moving average over top of the original data points to smooth out the volility. The catch is that I am not working with dates but rather with an indexed data set of various measurements.
Solved! Go to Solution.
Hi @dgwoodard
I'd need to see more of the model but try this:
DIAM_SMA_100 V2 =
VAR PeriodValue =
SELECTEDVALUE ( 'Period Sample'[Period Sample] )
VAR SelectedValue =
SELECTEDVALUE ( 'Table'[Index] )
RETURN
CALCULATE (
AVERAGE ( 'Table'[Measured Value] ),
'Table'[Index] <= SelectedValue,
'Table'[Index] >= SelectedValue - PeriodValue
)
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
That was quick! Thank you!
Hi @dgwoodard
I'd need to see more of the model but try this:
DIAM_SMA_100 V2 =
VAR PeriodValue =
SELECTEDVALUE ( 'Period Sample'[Period Sample] )
VAR SelectedValue =
SELECTEDVALUE ( 'Table'[Index] )
RETURN
CALCULATE (
AVERAGE ( 'Table'[Measured Value] ),
'Table'[Index] <= SelectedValue,
'Table'[Index] >= SelectedValue - PeriodValue
)
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |