- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Moving Average column
hello all i am trying to do a moving average column but having no success.
i am just trying for a moving average of 2 days, but the column seem to only show current day. i also shown my dax there for the calculated column in case you need to see. i can type it below for you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @SDPowerBI123 - The issue with your DAX formula for the moving average is that it calculates the average over only the current day
can you check the below modified one to get the current and previous days
Moving Average 2 Days =
CALCULATE(
AVERAGEX(
DATESINPERIOD(
'SPY 1 Years Daily'[Date],
LASTDATE('SPY 1 Years Daily'[Date]),
-2,
DAY
),
'SPY 1 Years Daily'[Close]
)
)
Hope this helps
Proud to be a Super User! | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Try this:
Moving Average 2 Days = VAR ld = LASTDATE('SPY 1 Years Daily'[Date])
VAR fd =DATESINPERIOD('SPY 1 Years Daily'[Date], ld,-2, DAY)
RETURN CALCULATE(AVERAGE('SPY 1 Years Daily'[Close]),ALL('SPY 1 Years Daily'),fd)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @SDPowerBI123 - The issue with your DAX formula for the moving average is that it calculates the average over only the current day
can you check the below modified one to get the current and previous days
Moving Average 2 Days =
CALCULATE(
AVERAGEX(
DATESINPERIOD(
'SPY 1 Years Daily'[Date],
LASTDATE('SPY 1 Years Daily'[Date]),
-2,
DAY
),
'SPY 1 Years Daily'[Close]
)
)
Hope this helps
Proud to be a Super User! | |

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
Anonymous
| 05-02-2024 05:56 AM | ||
05-01-2024 04:22 AM | |||
01-02-2024 06:26 AM | |||
Anonymous
| 10-24-2023 10:52 PM | ||
02-12-2024 01:18 PM |
User | Count |
---|---|
121 | |
104 | |
85 | |
52 | |
46 |