Tutorial with example: Calculate Moving averages in Power BI
In today’s video we will learn how to use DATESINPERIOD function using Moving Average calculation. First we will explain what a Moving average 3 months is and how it is calculated. Later on we will build a measure that will explain how DATESINPERIOD is used.
Download example file:
The dates argument can be any of the following:
- A reference to a date/time column,
- A table expression that returns a single column of date/time values,
- A Boolean expression that defines a single-column table of date/time values.
If the number specified for number_of_intervals is positive, the dates are moved forward in time; if the number is negative, the dates are shifted back in time.
The interval parameter is an enumeration, not a set of strings; therefore values should not be enclosed in quotation marks. Also, the values:
day should be spelled in full when using them.
The result table includes only dates that appear in the values of the underlying table column.
This DAX function is not supported for use in DirectQuery mode.